Browse Source

SPR-5932 - Singleton @Bean methods behave like prototypes in a Spring DM environment

* s/registerCallbacks/registerStaticCallbacks/ - see issue comments for full details
conversation
Chris Beams 16 years ago
parent
commit
9e0d87c518
  1. 3
      org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java

3
org.springframework.context/src/main/java/org/springframework/context/annotation/ConfigurationClassEnhancer.java

@ -117,7 +117,8 @@ class ConfigurationClassEnhancer { @@ -117,7 +117,8 @@ class ConfigurationClassEnhancer {
*/
private Class<?> createClass(Enhancer enhancer) {
Class<?> subclass = enhancer.createClass();
Enhancer.registerCallbacks(subclass, this.callbackInstances.toArray(new Callback[this.callbackInstances.size()]));
// registering callbacks statically (as opposed to threadlocal) is critical for usage in an OSGi env (SPR-5932)
Enhancer.registerStaticCallbacks(subclass, this.callbackInstances.toArray(new Callback[this.callbackInstances.size()]));
return subclass;
}

Loading…
Cancel
Save