Announcement Announcement Module
Collapse
No announcement yet.
XML vs Java Configuration issue when using Aspect-J Load Time Weaving Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • XML vs Java Configuration issue when using Aspect-J Load Time Weaving

    Hi,

    Why is it that when I use the XML based approach to configure Load Time Weaving everything seems to work properly but when I used the Java Configuration approach my aspects never get weaved.

    This works:

    applicationContext.xml

    <context:spring-configured /> <!-- I believe this declaration is not required since it is implicitly enabled when aspectj-weaving is used -->
    <context:load-time-weaver aspectj-weaving="autodetect" />

    and then

    @Configurable
    public class MyDomainClass {

    ...

    }


    This doesn't work.

    @Configuration
    @ComponentScan(...)
    @PropertySource("classpath:spring.properties")
    @Import({ CachingConfig.class, PersistenceConfig.class })
    @EnableSpringConfigured
    @EnableLoadTimeWeaving(aspectjWeaving=AspectJWeavi ng.AUTODETECT) //This is the default though I'm putting it here for clarity
    public class RootConfig {
    ....

    }

    and then

    @Configurable
    public class MyDomainClass {

    ...

    }

    Is there anything that I'm missing?

    Thanks.

    -tony
    Last edited by agonza01; Feb 17th, 2012, 11:03 PM. Reason: Correcting post title

  • #2
    Hi Tony,

    Please follow the instructions at https://github.com/SpringSource/spri...-issues#readme to put together a simple project that reproduces this behavior. Please include a test that demonstrates the XML configuration working and the @Configuration approach failing.

    Thanks!

    Chris

    Comment


    • #3
      Will do so.

      Thanks Chris.

      -tony

      Comment

      Working...
      X