Announcement Announcement Module
No announcement yet.
aop:config conflicting with annotation based autowiring Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • aop:config conflicting with annotation based autowiring

    Hi All,

    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">
    <aopointcut id="applicationSecurityPointCut"
    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.