Announcement Announcement Module
Collapse
No announcement yet.
aspectj-autoproxy prevents DI? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • aspectj-autoproxy prevents DI?

    It seems that the autoproxy is mutually exclusive with DI. I'm not sure why:

    <bean id="X" class="X" scope="prototype">
    <property name="name" value="name"/>
    </bean>

    If I use getBean("X") to get this bean, the name member is set to "name" as you'd expect. Using this configuration, with the aspectj-autoproxy and a simple aspect that just wraps a timer around any bean, disables the dependency injection?

    I'm literally just adding this.

    <aop:aspectj-autoproxy/>
    <bean id="myAspect" class="Timer"/>

    The advice was applied, I get a proxy back, but the proxy is not dependency injected. Does anyone know why?

  • #2
    Is there some additional flag, or some restriction that's not documented? I've been going through the reference documentation but it doesn't seem to mention this or include an example of an object that's both had an Aspect applied and been dependency injected.

    Comment


    • #3
      Originally posted by scrop View Post
      Is there some additional flag, or some restriction that's not documented? I've been going through the reference documentation but it doesn't seem to mention this or include an example of an object that's both had an Aspect applied and been dependency injected.
      Having the exact same problem. Have you found a solution for this?

      Comment

      Working...
      X