I am looking at a application where I see the below issues
- I am trying to add a simple interceptor as mentioned on Spring website http://static.springsource.org/sprin...ansaction.html
In the service, I am trying to add advice(XYZService) to, there is a dependency which has @Autowired annotation
<!-- this is the aspect -->
<bean id="profiler" class="x.y.SimpleProfiler">
<!-- execute before the transactional advice (hence the lower order number) -->
<property name="order" value="1"/>
<tx:annotation-driven transaction-manager="txManager" order="200"/>
<!-- this advice will execute around the transactional advice -->
<aop:aspect id="profilingAspect" ref="profiler">
<aop:around method="profile" pointcut-ref="serviceMethodWithReturnValue"/>
The above mentioned ABFactory is a class and not a interface.( This is existing code and I am not sure why the autowiring has been done to class and not interface).
private ABFactory abFactory;
When i try running test class, get following error
Caused by: org.springframework.aop.framework.AopConfigExcepti on: Cannot proxy target class because CGLIB2 is not available. Add CGLIB to the class path or specify proxy interfaces.
I do not want to add CGLIb proxies as it is better to use JDK dynamic proxies.
If I remove the custom interceptor and leave the "<tx:annotation-driven transaction-manager.." advice it works. Why is the issue with CGLib proxies only happening when I try the <aop:config> for custom advice. Should the behavior not be same for the transaction advice as well?