Announcement Announcement Module
No announcement yet.
Odd behaviour after creating CustomScopeConfigurer bean Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #2
    Here is some sample code: