Results 1 to 5 of 5

Thread: Clash between schema based aop and ProxyFactoryBean

  1. #1
    Join Date
    Dec 2007
    Location
    Belgium
    Posts
    24

    Post 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. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3
    Join Date
    Dec 2007
    Location
    Belgium
    Posts
    24

    Default

    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 ?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    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.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Dec 2007
    Location
    Belgium
    Posts
    24

    Default

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •