Results 1 to 3 of 3

Thread: How to override resp. redefine a bean ?

  1. #1

    Default 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. #2
    Join Date
    Apr 2007
    Posts
    307

    Default

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

  3. #3

    Default

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

Posting Permissions

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