Announcement Announcement Module
Collapse
No announcement yet.
Missing beans BeanNameAutoProxyCreator/BeanPostProcessor? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Missing beans BeanNameAutoProxyCreator/BeanPostProcessor?

    Hi,

    I have a strange behaviour with the BeanNameAutoProxyCreator/BeanPostProcessor.

    Project A:

    bean1, bean2, etc. are advised successfully by advisors (through BeanNameAutoProxyCreator).

    Project B (Web application):

    This project uses project A packed as a JAR file. Included are the spring configs for bean1, bean2 and the advisors in the JAR.

    ----------------------

    Now what happens when running Project B is that bean1 is being advised as expected, but bean2 is not advised.

    Looking at the log statements of BeanNameAutoProxyCreator, I discovered that a number of beans of Project A are obviously missing/na when the BeanNameAutoProxyCreator is trying to find matches.

    Running the web application however, bean2 is available BUT NOT advised.

    Testing further with a simple BeanPostProcessor that simply sysouts all bean names, again several beans of Project A are not going through the bean post processor.

    Code and setting-wise, bean1 and bean2 are of the same type - is there anything or any code that blocks beans to be passed to the BeanPostProcessor/BeanNameAutoProxyCreator that I am not aware of? Or is it true that ALL beans (if everything works fine) are passed to a BeanNameAutoProxyCreator?

    Best regards,

    Manri

  • #2
    Solved

    Digging around for several hours, I found the cause of this behaviour.

    In our Projects we usually use the @Transactional annotation.

    There was an exception and one of our services in Project A used the TransactionProxyFactoryBean.

    bean2 and all other missing beans were referenced by this evil service and weren't visible in BeanPostProcessor.

    Replacing this service in Project A with @Transactional solved my problem.

    Thanks for taking your time ;-)

    Comment

    Working...
    X