In above scenario autowiring fails with exception "illegalArgumentException : argument type mismatch". When i remove `implements service` from MyService everything works fine.Code:public interface Service { public void doSomething(); } @Service public class MyService implements service{ @Transactional public void doSomething(){ } } @Controller public class MyController { @Autowired private MyService service; }
I have searched and found that place `<aop:aspectj-autoproxy proxy-target-class="true"/>` in applicationContext.xml for successful autowiring. and it worked.
I have also found that spring uses JDK proxy when @Transactional is used.
I have some confusions,
1. How @Transactional relates to Proxying
2. Why spring uses JDK Proxy for the beans which implements interfaces.
3. Why i need to place `<aop:aspectj-autoproxy proxy-target-class="true"/>` in applicationContext.xml
Can anyone please explain ? or refer me any article or blog


Reply With Quote
