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

  • Adding DI to Advice Objects.


    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:
    <!-- All services need to be proxied for security -->
    <bean id="TestService" class="org.springframework.aop.framework.ProxyFactoryBean" >
    	<property name="target">
    		<ref local="TestServiceTarget" />
    	  <property name="interceptorNames">
    <!-- Standard Advisor for all calls. -->
    <bean id="CheckPolicyAdvice"
    class="" >
    	<property name="Actor"  >
    		<idref local="Actor" />
    <bean id="Actor" class="" />
    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.


    • #3
      Thank you.

      Thank you. That was the problem.