Announcement Announcement Module

JavaConfig forum decommissioned in favor of Core Container

As described at

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:

For any questions related to @Configuration classes and @Bean methods in Spring 3.0, please post in the dedicated 'Core Container' forum at
See more
See less
How to override resp. redefine a bean ? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • 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:

    public class SpringConfig implements BeanFactoryAware, ApplicationContextAware {
    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.


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