Results 1 to 4 of 4

Thread: how to avoid specific classes in beanNames

  1. #1

    Default how to avoid specific classes in beanNames

    I have an interceptor and I want to apply it to all beans except a certain class. How do i achieve this.

    for all beans i use this
    <property name="beanNames"><value>*</value></property>

    for selected classes I use this
    <property name="beanNames"><value>*Controller,Hib*,*Intf</value></property>

    but now sure how to define one for all classes except say (*Intf)

    Thanks in advance.

  2. #2
    Join Date
    Mar 2007
    Posts
    515

    Default

    I don't think you have a way to exclude a certain pattern from matching.
    I'd take a look at the source code for the proxy creator class you are using and extend it in a way to add something like: excludedNames property.

    Another solution would be to use an AspectJ pointcut: execution(* my.package.*(..) && !execution(* not.interceptable.package.*(..))

  3. #3

    Default

    Thanks for your response. I will take a look at the options.

  4. #4
    Join Date
    Mar 2005
    Posts
    135

    Default

    You could also introduce an annotation that will tag the method/class as excludable from your specific pointcut definition.

Posting Permissions

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