Fix unnecessary required spring-context-support dep

Prior to this commit, a project using compile time weaving upgrading to
4.1 was forced to add spring-context-support and the jcache API in order
to build. This problem is not new really: spring-aspects holds all
aspects provided by the framework and they all are evaluated when
compiling. 4.1 just happens to define a new aspect that requires extra
dependencies.

This commit uses a new annotation of AspectJ 1.8.3. When @RequiredTypes
is added on an aspect, it is evaluated only if the classes defined on the
annotation are actually present. If they are not, the aspect is disabled
and does not break the build.

Issue: SPR-12163
This commit is contained in:
Stephane Nicoll 2014-10-20 17:39:11 +02:00
parent d5eb669416
commit 222d2b1639
2 changed files with 3 additions and 1 deletions

View File

@ -27,7 +27,7 @@ configure(allprojects) { project ->
group = "org.springframework"
version = qualifyVersionIfNecessary(version)
ext.aspectjVersion = "1.8.2"
ext.aspectjVersion = "1.8.3"
ext.eclipseLinkVersion = "2.4.2"
ext.ehcacheVersion = "2.9.0"
ext.ehcacheJCacheVersion = "1.0.0"

View File

@ -22,6 +22,7 @@ import javax.cache.annotation.CacheRemove;
import javax.cache.annotation.CacheRemoveAll;
import javax.cache.annotation.CacheResult;
import org.aspectj.lang.annotation.RequiredTypes;
import org.aspectj.lang.annotation.SuppressAjWarnings;
import org.aspectj.lang.reflect.MethodSignature;
@ -43,6 +44,7 @@ import org.springframework.cache.jcache.interceptor.JCacheAspectSupport;
* @author Stephane Nicoll
* @since 4.1
*/
@RequiredTypes({"org.springframework.cache.jcache.interceptor.JCacheAspectSupport", "javax.cache.annotation.CacheResult"})
public aspect JCacheCacheAspect extends JCacheAspectSupport {
@SuppressAjWarnings("adviceDidNotMatch")