Announcement Announcement Module
Collapse
No announcement yet.
Dynamic advice ?? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Dynamic advice ??

    For dynamic pointcut the following does not work but works for static pointcuts if I use the RegexpMethodPointcutAdvisor. Any help would be appreciated. :x



    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    <beans >

    <!--CONFIG-->
    <bean id="businesslogicbean" class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>IBusinessLogic</value>
    </property>

    <property name="target">
    <ref local="beanTarget"/>
    </property>
    <property name="interceptorNames">
    <list>
    <value>theAroundAdvisor</value>
    </list>
    </property>
    </bean>

    <!--CLASS-->
    <bean id="beanTarget" class="BusinessLogic"/>

    <!--ADVISOR-->
    <!--Note: An advisor assembles pointcuts and advice-->
    <!-- <bean id="theAroundAdvisor" class="org.springframework.aop.support.RegexpMetho dPointcutAdvisor">
    <property name="advice">
    <ref local="theAroundAdvice"/>
    </property>
    <property name="pattern">
    <value>.*</value>
    </property>
    </bean> -->

    <bean id="mypointcut" class="org.springframework.aop.support.ControlFlow Pointcut">
    <constructor-arg index="0" >
    <value>AroundAdvice</value>
    </constructor-arg>
    </bean>

    <bean id="theAroundAdvisor" class="org.springframework.aop.support.DefaultPoin tcutAdvisor">
    <property name="pointcut">
    <ref local="mypointcut"/>
    </property>
    <property name="advice">
    <ref local="theAroundAdvice"/>
    </property>
    </bean>

    <bean id="theAroundAdvice" class="AroundAdvice" />
    </beans>

  • #2
    Julius,

    What error are you getting? I think you may have specified the wrong class in the constructor for ControlFlowPointcut. You need to specify the class you want to pointcut not the advice class.

    Rob

    Comment


    • #3
      No error ut advice is not getting applied

      I am not getting any error but the advice is not getting applied.
      Regarding passing the actual class to pointcut I tried the actual class "BusinessLogic" too. It didnt seem to work either. All it does is runs the BusinessLogic class's foo method but no advice is applied.

      Comment


      • #4
        Anybody?

        Anybody can help me on this?what could be wrong?

        Comment

        Working...
        X