Announcement Announcement Module
Collapse
No announcement yet.
Configuration required without ProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Configuration required without ProxyFactoryBean

    Hi All,

    I want to intercept a code in my action class .So i will not be having any interface call that action.(obvious).


    For using service call i am using


    <bean id="businesslogicbean"
    class="org.springframework.aop.framework.ProxyFact oryBean">
    <property name="proxyInterfaces">
    <value>IAopDemoInterface</value>
    </property>
    <property name="target">
    <ref local="beanTarget"/>
    </property>
    <property name="interceptorNames">
    <list>
    <value>theTracingBeforeAdvisor</value>
    <value>theTracingAfterAdvisor</value>
    </list>
    </property>
    </bean>

    Unlike the above configuration i dont need any interface now..


    i want to intercept some code in action class......

    How will be my configuration ....

    It should be like this ..no where i am using spring for instantiating my action. I need spring only for AOP ..So how will be my configuration file.?

    It is like that every time an action is called i want to intercept some code....


    Any solution?

    Thanx in Advance ,

    TOM

  • #2
    I don't understand the question. If it's "can I intercept methods on a class with no interface," the answer is Yes. Set the proxyTargetClass flag to true and ensure you have the CGLIB JAR on your classpath.

    Comment


    • #3
      Re: Configuration required without ProxyFactoryBean

      Just omit the interfaces list.
      Then the framework will create a proxy of the class and the interceptors will have the possibility to advise all the methods in the class.
      This REQUIRES CGLib.
      Code:
      <bean id="businesslogicbean"
          class="org.springframework.aop.framework.ProxyFactoryBean">
        <property name="target">
          <bean class="your.original.asdvised.ClassName"/>
        </property>
        <property name="interceptorNames">
          <list>
            <value>theTracingBeforeAdvisor</value>
            <value>theTracingAfterAdvisor</value>
          </list>
        </property>
      </bean>

      Comment

      Working...
      X