Feb 18th, 2008, 11:12 PM
aop:config conflicting with annotation based autowiring
I have recently tried to implement an aspect over my service layer using acegi security and have found that introducing the following config breaks my existing autowiring...
<aop:aspect id="applicationSecurityAspect" ref="applicationSecurity">
expression="execution(* com.mycompany.myapp.core.*.application.spi.*(..) )" />
I'm using a combination of @Component, @Service and @Repository annotations plus <context:component-scan ... /> config to wire up my application. I use @Autowired for constructor injection. Spring version is 2.5.1.
Until I tried to introduce an aspect into the mix things were working well. As soon as I introduce the <aop:config stuff my app tells me I have unsatisfied dependencies in beans far removed from the stuff i'm trying to auto proxy. In fact I only have to introduce the following for it to break...
I don't know exactly how this config effects the loading of bean definitions. I'm assuming it must introduce some proxying and this is conflicting with the autwiring and component scanning.
Another observation is this...
If I try configuring it using a ProxyFactoryBean I get identical behaviour.