- Notifications
You must be signed in to change notification settings - Fork 38.8k
Description
Hello, until 6.1.7 my program had been working fine for many years, but 6.2.0 introduced a change that made it break with:
"Could not register object [presetClientService@5404b7d9] under bean name 'blabla': there is already object [presetClientService@5404b7d9] bound"
The hash Id is the same so I'm under the impression that some bean is found in the bean registry and spring tries to re-add it in the registry. Why ?!
I was not able to create a simple reproducer yet.
To give you more details the code looks like this with 3 @configuration classes referenced:
AnnotationConfigApplicationContext sphereContext = new AnnotationConfigApplicationContext(MainSphereSpringContext.class); AnnotationConfigApplicationContext moduleContext = new AnnotationConfigApplicationContext(); moduleContext.register(ModuleSpringConfig.class, OleaDockingSpringConfig.class); moduleContext.setParent(sphereContext); moduleContext.refresh();
And the failing @configuration class contains:
@Bean public PresetClientService presetClientService() { return new PresetClientService(someService()); } @Bean public ModuleConfigPresenterImpl configPresenter() { return new ModuleConfigPresenterImpl(segmentActionDirectory(), presetClientService()); }
The problem comes from the call to presetClientService(). If I replace this call with null, the loading of the context is OK.
Was working fine since years and broke with 6.2.0.
I could re-try to create a real-failing sample if really needed, but for now I failed at it.
Regards