Announcement Announcement Module
Collapse

JavaConfig forum decommissioned in favor of Core Container

As described at

http://static.springsource.org/sprin...fig/README.TXT

key features of the Spring JavaConfig project have been migrated into the core Spring Framework as of version 3.0.

Please see the Spring 3.0 documentation on @Configuration and @Bean support:

http://static.springsource.org/sprin...tml#beans-java

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at

http://forum.springsource.org/forumdisplay.php?f=26
See more
See less
How to override resp. redefine a bean ? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to override resp. redefine a bean ?

    I'm using Spring 3.0.0 and the included JavaConfig. The configuration is done in a class which looks like:

    @Configuration
    public class SpringConfig implements BeanFactoryAware, ApplicationContextAware {
    ...
    @Bean
    public LoadTimeWeaver loadTimeWeaver() {
    return new ReflectiveLoadTimeWeaver();
    }
    ...
    }

    In my JUnit-Tests I want to redefine the bean "loadTimeWeaver". How can I achieve this? Only via XML config?

  • #2
    You could also extend the SpringConfig class and override the loadTimeWeaver() method. Provide a more complete example and I'll be able to provide a more complete solution.

    Comment


    • #3
      It works fine. I couldn't believe that it's that easy!

      Comment

      Working...
      X