Announcement Announcement Module
Collapse
No announcement yet.
Adding DI to Advice Objects. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Adding DI to Advice Objects.

    Hi,

    I am still new to AOP and Spring. I've searched the archive and I can't seem to locate an answer to the following problem.

    In my applicationContext.xml I have the following:
    Code:
    <!-- All services need to be proxied for security -->
    <bean id="TestService" class="org.springframework.aop.framework.ProxyFactoryBean" >
    	<property name="target">
    		<ref local="TestServiceTarget" />
    	</property>
    	  <property name="interceptorNames">
    		<list>
    	           <value>CheckPolicyAdvice</value>
    		</list>
    	</property>
    </bean>
    	
    <!-- Standard Advisor for all calls. -->
    <bean id="CheckPolicyAdvice"
    class="ui.security.CheckPolicyAdvice" >
    	<property name="Actor"  >
    		<idref local="Actor" />
    	</property>
    </bean>
    
    <bean id="Actor" class="ui.security.StaticActor" />
    When Spring initializes, it throws an error telling me CheckPolicyAdvice does not have a writable property 'Actor'. I have verified the getter/setter and I suspect it is because Spring only see's CheckPolicyAdvice as a MethodInterceptor Interface.

    I can not find any advice examples which have DI/IoC for an Advice. I am using Spring-1.2 RC2.

    Can someone show me the error of my ways?[/code]

  • #2
    DI can be applied to AOP framework classes such as advices.

    The error message is almost certainly correct. If the setter is setActor, following JavaBean conventions, the property name is "actor". Note the lower case 'a'. It's not to do with AOP.

    Comment


    • #3
      Thank you.

      Thank you. That was the problem.

      Jason

      Comment

      Working...
      X