Announcement Announcement Module
No announcement yet.
Spring does not advise bean when autoproxy configuration comes from imported xml. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring does not advise bean when autoproxy configuration comes from imported xml.


    I have a multi-module application, when a particular module has a aspect bean that must intercept method calls originated from beans of other modules. This particular module, where the aspect is, has a configuration xml where the aspectj:autoproxy configuration resides.

    When I import this xml configuration from other modules, I expect Spring to load not only the beans defined in the imported xml configuration, but the aspectj and other configurations as well.

    But, instead, it doesn't load the aspectJ configuration.
    I've set the spring log4J configuration to debug mode, and I can see the configuration file is actually loaded, the beans from imported xml are loaded as well, but not the aspectJ autoproxy feature.

    i.e.: I have module A with a aspect bean and the autoproxy configuration, and module B, which uses A and imports it's xml configuration. If I only import A's configuration, the aspect does not work. If I configure B with aspectj:autoproxy, then it works fine.

    I wish not to keep repeating the same configuration in other modules which uses A.

    Is there a way to get that??

    Thanks, in advance.
    Last edited by mvgagliotti; Jan 23rd, 2012, 04:37 AM.

  • #2
    Hmm, odd problem, I always have my aspectj configuration in a separate xml config file and import it into my main xml config file and it works fine.

    Can you post your config files here? Maybe your import of A into B is not including everything.



    • #3
      Now, it works!

      Thanks for replying!

      Well, it's really strange, I have left this issue unresolved to deal with another things, and just come back to it today, and guess what?
      It worked fine!

      I really don't know what I did different, maybe the pointcut expression was a bit different, since it's the only thing I changed.

      If I figure out what the problem was, I post it here, but I hope it does not happen again!!