Description
David Fogel opened SPR-5932 and commented
What we are seeing is that when we use @Configuration-annotated
configuration classes to define our beans, that our singleton beans are instead treated as prototype beans. This means that we get new instances of our singletons for each time they are referenced (!!!).
I have created sample code which demonstrates this broken behavior.
This code, when run as a regular spring-ified java application, (NOT OSGi), works as expected (only ONE instance of Foo and Bar are created).
BUT, when the identical code is run via Spring DM, THREE different instances of Bar are created!
Note: I used a FileSystemXmlApplicationContext to load this when running as a normal java application, and put the config.xml file inside a /META-INF/spring folder when running in Spring dm.
Affects: 3.0 M3
Reference URL: http://forum.springsource.org/showthread.php?t=74458
Attachments:
- spring-dm-javaconfig-bug.zip (2.96 kB)
Issue Links:
- SJC-89 Ensure OSGi / Spring Dynamic Modules compatibility ("is duplicated by")
- Java config FactoryBean proxy causes class loader leak [SPR-9274] #13912 Java config FactoryBean proxy causes class loader leak
- Concurrent creation of the same Configuration class in different contexts is not thread-safe [SPR-10307] #14941 Concurrent creation of the same Configuration class in different contexts is not thread-safe
Referenced from: commits 9e0d87c