From 512a78ea7297d06a22da777dfd421bc32de6f213 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 fe53ca01f..b4461b3c6 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 @@ -101,7 +101,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 +