From 1f6f1df58b3ad088c3c5c746cf4b237380449bb1 Mon Sep 17 00:00:00 2001 From: Martin Baumgartner Date: Sun, 9 Mar 2014 15:10:14 +0100 Subject: [PATCH] DATAJPA-494 - Fix template.mf to make sure auditing can be used on OSGi. template.mf now contains an explicit Import-Package directive to make sure the relevant packages for the auditing functionality can be resolved in an OSGi environment. This hadn't been the case before as we don't explicitly refer to some classes necessary (mostly to prevent class loading errors in IDEs). The explicit declarations make sure the relevant Import-Package declarations are added even if Bundlor doesn't find any types that would explicitly require the imports. JpaAuditingRegistrar now also explicitly hints to the class not being visible in case of auditing setup errors. Original pull request: #62. --- .../data/jpa/repository/config/JpaAuditingRegistrar.java | 3 ++- template.mf | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java b/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java index 13c985d07..ce0149200 100644 --- a/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java +++ b/src/main/java/org/springframework/data/jpa/repository/config/JpaAuditingRegistrar.java @@ -92,7 +92,8 @@ class JpaAuditingRegistrar extends AuditingBeanDefinitionRegistrarSupport { } if (!ClassUtils.isPresent(BEAN_CONFIGURER_ASPECT_CLASS_NAME, getClass().getClassLoader())) { - throw new BeanDefinitionStoreException("Could not configure Spring Data JPA auditing-feature because" + throw new BeanDefinitionStoreException(BEAN_CONFIGURER_ASPECT_CLASS_NAME + " not found. \n" + + "Could not configure Spring Data JPA auditing-feature because" + " spring-aspects.jar is not on the classpath!\n" + "If you want to use auditing please add spring-aspects.jar to the classpath."); } diff --git a/template.mf b/template.mf index 3d5133124..13f9dcf8c 100644 --- a/template.mf +++ b/template.mf @@ -22,4 +22,7 @@ Import-Template: org.springframework.beans.factory.aspectj;version="${spring:[=.=.=.=,+1.1.0)}";resolution:=optional, org.springframework.data.*;version="${springdata.commons:[=.=.=.=,+1.0.0)}", org.w3c.*;version="0.0.0" - \ No newline at end of file +Import-Package: org.aspectj.lang;version="${aspectj:[=.=.=,+1.0.0)}";resolution:=optional, + org.aspectj.runtime.reflect;version="${aspectj:[=.=.=,+1.0.0)}";resolution:=optional, + org.springframework.beans.factory.aspectj;version="${spring:[=.=.=.=,+1.1.0)}";resolution:=optional +