Skip to content

Commit 9e0d87c

Browse files
committed
SPR-5932 - Singleton @bean methods behave like prototypes in a Spring DM environment
* s/registerCallbacks/registerStaticCallbacks/ - see issue comments for full details
1 parent 977cee4 commit 9e0d87c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ private Enhancer newEnhancer(Class<?> superclass) {
117117
*/
118118
private Class<?> createClass(Enhancer enhancer) {
119119
Class<?> subclass = enhancer.createClass();
120-
Enhancer.registerCallbacks(subclass, this.callbackInstances.toArray(new Callback[this.callbackInstances.size()]));
120+
// registering callbacks statically (as opposed to threadlocal) is critical for usage in an OSGi env (SPR-5932)
121+
Enhancer.registerStaticCallbacks(subclass, this.callbackInstances.toArray(new Callback[this.callbackInstances.size()]));
121122
return subclass;
122123
}
123124

0 commit comments

Comments
 (0)