Results 1 to 3 of 3

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

  1. #1
    Join Date
    Mar 2005
    Posts
    2

    Default 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 at 11:03 PM. Reason: Correcting post title

  2. #2
    Join Date
    Apr 2007
    Posts
    307

    Default

    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
    Chris Beams
    Spring Framework committer, VMware
    http://github.com/cbeams

  3. #3
    Join Date
    Mar 2005
    Posts
    2

    Default

    Will do so.

    Thanks Chris.

    -tony

Posting Permissions

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