Feb 18th, 2013, 10:31 AM
Odd behaviour after creating CustomScopeConfigurer bean
I have the following test setup:
A test class (MyTest) that is run with spring's junit4 runner.
The test class depends on a spring java config class (MyTestConfig)
A java config class (MyTestConfig) that implements a common interface (MyTestInterface)
A java config interface (MyTestInterface)
Another java config class (AbstractConfig), that has an autowired dependency on the config interface.
Everything works and the configuration objects are autowired nicely. As soon as I instantiate a bean of type CustomScopeConfigurer inside the AbstractConfig class, the autowired MyTestInterface object is null by the time it needs to be accessed. There is no notion of scope annotations anywhere in the program, I am simply creating the CustomScopeConfigurer bean as part of the AbstractConfig class. The funny thing is, if I move this bean definition to the MyTestConfig class, then the autowiring happens and everything is fine.
Is there something happening I'm not aware of when you declare a CustomScopeConfigurer bean?
If required, I can post some code.
Feb 18th, 2013, 11:56 AM