caching - spring cache and aspectj -


i want use @cacheable annotations on objects not managed spring. using maven-aspectj compiler complile classes. dont see getting woven.

i dont have @aspect,as assuming spring should take care of cache related annotations. have following in config file.

i made couple of change after googling

<cache:annotation-driven mode="aspectj"/> <context:annotation-config /> <context:component-scan base-package="com.merc.spring.cache.aspectj" /> 

added aop.xml in meta-inf folder following in it

<aspectj> <weaver options="-verbose -showweaveinfo"> <include within="com.merc.spring.cache.aspectj..*"/> </weaver> </aspectj> 

just validate if @cacheable classes getting weaved cacheaspect, can add maven aspectj plugin:

<configuration> <showweaveinfo>true</showweaveinfo> 

edit

i pasting entire aspectj plugin configuration, works me in project:

 <plugin> <groupid>org.codehaus.mojo</groupid> <artifactid>aspectj-maven-plugin</artifactid> <version>1.4</version> <dependencies> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjrt</artifactid> <version>${aspectj.version}</version> </dependency> <dependency> <groupid>org.aspectj</groupid> <artifactid>aspectjtools</artifactid> <version>${aspectj.version}</version> </dependency> </dependencies> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> <configuration> <outxml>true</outxml> <showweaveinfo>true</showweaveinfo> <verbose>true</verbose> <aspectlibraries> <aspectlibrary> <groupid>org.springframework</groupid> <artifactid>spring-aspects</artifactid> </aspectlibrary> </aspectlibraries> <source>${java.version}</source> <target>${java.version}</target> </configuration> </plugin> 

my java.version, aspectj.version set to:

<properties> <aspectj.version>1.6.12</aspectj.version> <java.version>1.6</java.version> </properties> 

Comments