Announcement Announcement Module
Collapse
No announcement yet.
negate bean PCD Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • negate bean PCD

    Hi

    I have pointcut expression using Spring aop
    Code:
    <aop:pointcut id="valManDaoMethods" expression="bean(*Validator) or bean(*Manager) or bean(*DAO)"/>
    It works great and it matches all methods on beans named *Validator, *Manager and *DAO.
    But, I would like to express pointcut that matches the same beans as above but except for following beans:cacheManager and transactionManager.

    I read from Spring manual that it is possible to negate expression and tried sth like:

    Code:
    <aop:pointcut id="valManDaoMethods" expression=" (bean(*Validator) or bean(*Manager) or bean(*DAO) ) and !bean(cacheManager ) and !bean(transactionManager)"/>
    But it does not work as expected.

    Can anyone help

  • #2
    Originally posted by miluch View Post
    Hi

    I have pointcut expression using Spring aop
    Code:
    <aop:pointcut id="valManDaoMethods" expression="bean(*Validator) or bean(*Manager) or bean(*DAO)"/>
    It works great and it matches all methods on beans named *Validator, *Manager and *DAO.
    But, I would like to express pointcut that matches the same beans as above but except for following beans:cacheManager and transactionManager.

    I read from Spring manual that it is possible to negate expression and tried sth like:

    Code:
    <aop:pointcut id="valManDaoMethods" expression=" (bean(*Validator) or bean(*Manager) or bean(*DAO) ) and !bean(cacheManager ) and !bean(transactionManager)"/>
    But it does not work as expected.

    Can anyone help
    Looks like its a bug in spring-aop. The following doesn't work either

    Code:
    @Pointcut("! bean(sampleServiceImpl)")

    Comment


    • #3
      Please file a bug and I will take a look.

      Comment


      • #4
        I have just created issue number SPR-4860.
        If more info and/or working example is needed pls let me know.
        I hope you can reproduce the issue and provide workaround/solution/patch.

        Comment


        • #5
          Fixed it. It is available in the latest nightly build and the upcoming release.

          -Ramnivas

          Comment


          • #6
            you run it on tomcat?

            Comment

            Working...
            X