Announcement Announcement Module
Collapse
No announcement yet.
Clash between schema based aop and ProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Clash between schema based aop and ProxyFactoryBean

    I use aop for transaction management, using the aop schema for configuring the context.

    I also have a bean that I proxy with a ProxyFactoryBean that uses a RegexpMethodPointcutAdvisor.

    Now when Spring initializes the context, it picks up the RegexpMethodPointcutAdvisor in the AspectJAwareAdvisorAutoProxyCreator as an eligible advisor for my bean. Thus it creates a proxy.

    I guess this AspectJAwareAdvisorAutoProxyCreator is a bean post processor that is instantiated automatically when I use the aop schema in my context definition.

    However I choose to use the ProxyFactoryBean to define my bean, because I want to decide myself how the proxy should be created.

    Is there a way to prevent the AspectJAwareAdvisorAutoProxyCreator to pick up the RegexpMethodPointcutAdvisor that I use in the ProxyFactoryBean?

  • #2
    Try declaring it as an inner bean to your ProxyFactoryBean. Next to that I don't think it is wise to mix strategies, try to stick with one.

    Comment


    • #3
      Exactly what bean do you want me to declare as an inner bean?

      I did declare the target bean as an inner bean, without success. The interceptors cannot be declared as inner beans, according to the spring-aop documentation.

      I don't care if it's wise to mix strategies or not. Either it is allowed and it should work, either it isn't allowed and then I would like to get an error when starting up. If Spring cannot cope with mixing strategies, it should dissallow them.

      Desides that, I have no intention on changing all my aop-schema declared beans. Most of them are used for transaction management. It would be a lot of work changing all that.

      Should I conclude: DON'T use ProxyFactoryBean if you use aop-schema based configuration ?

      Comment


      • #4
        Mixing up different interceptors here . Indeed the PFB only takes names of the interceptors.

        It is allowed but can lead to all sorts of problems, double proxying being one of the most common.

        Desides that, I have no intention on changing all my aop-schema declared beans. Most of them are used for transaction management. It would be a lot of work changing all that.
        I no where said you should change your aop-schema stuff. I would recommend to remove the ProxyFactoryBean. Why do you need the PFB if you also have a aop-schema declaration.

        Comment


        • #5
          I need to use a PFb to advice a class that extends JDialog, because JDialog implements a non-public interface and trying to proxy it throws a IllegalAccessError. Therefor I was hoping to use a PFB to limit the implemented interfaces for the proxy. Without succes

          Comment

          Working...
          X