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.
This commit is contained in:
Martin Baumgartner
2014-03-09 15:10:14 +01:00
committed by Oliver Gierke
parent c4b651b6f7
commit 1f6f1df58b
2 changed files with 6 additions and 2 deletions

View File

@@ -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.");
}

View File

@@ -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"
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