Avoid duplicates from <websocket:decorator-factory>

Before this change <websocket:decorator-factory> decorated to
the SubProtocolWebSocketHandler RootBeanDefinition rather than
using a RuntimeBeanReference, which led to a separate instance
of SubProtocolWebSocketHandler to be created.

Issue: SPR-13190
This commit is contained in:
Rossen Stoyanchev
2015-07-02 16:03:35 -04:00
parent 2c32873309
commit 3eb54cc0b3
2 changed files with 34 additions and 12 deletions

View File

@@ -260,7 +260,7 @@ class MessageBrokerBeanDefinitionParser implements BeanDefinitionParser {
if (factoriesElement != null) {
ManagedList<Object> factories = extractBeanSubElements(factoriesElement, context);
RootBeanDefinition factoryBean = new RootBeanDefinition(DecoratingFactoryBean.class);
factoryBean.getConstructorArgumentValues().addIndexedArgumentValue(0, handlerDef);
factoryBean.getConstructorArgumentValues().addIndexedArgumentValue(0, result);
factoryBean.getConstructorArgumentValues().addIndexedArgumentValue(1, factories);
result = new RuntimeBeanReference(registerBeanDef(factoryBean, context, source));
}