use of org.springframework.beans.factory.config.RuntimeBeanReference in project spring-framework by spring-projects.
the class MessageBrokerBeanDefinitionParser method registerUserRegistryMessageHandler.
private RuntimeBeanReference registerUserRegistryMessageHandler(RuntimeBeanReference userRegistry, RuntimeBeanReference brokerTemplate, String destination, ParserContext context, Object source) {
Object scheduler = WebSocketNamespaceUtils.registerScheduler(SCHEDULER_BEAN_NAME, context, source);
RootBeanDefinition beanDef = new RootBeanDefinition(UserRegistryMessageHandler.class);
beanDef.getConstructorArgumentValues().addIndexedArgumentValue(0, userRegistry);
beanDef.getConstructorArgumentValues().addIndexedArgumentValue(1, brokerTemplate);
beanDef.getConstructorArgumentValues().addIndexedArgumentValue(2, destination);
beanDef.getConstructorArgumentValues().addIndexedArgumentValue(3, scheduler);
String beanName = registerBeanDef(beanDef, context, source);
return new RuntimeBeanReference(beanName);
}
use of org.springframework.beans.factory.config.RuntimeBeanReference in project spring-framework by spring-projects.
the class MessageBrokerBeanDefinitionParser method registerMessagingTemplate.
private RuntimeBeanReference registerMessagingTemplate(Element element, RuntimeBeanReference brokerChannel, RuntimeBeanReference messageConverter, ParserContext context, Object source) {
ConstructorArgumentValues cavs = new ConstructorArgumentValues();
cavs.addIndexedArgumentValue(0, brokerChannel);
RootBeanDefinition beanDef = new RootBeanDefinition(SimpMessagingTemplate.class, cavs, null);
if (element.hasAttribute("user-destination-prefix")) {
beanDef.getPropertyValues().add("userDestinationPrefix", element.getAttribute("user-destination-prefix"));
}
beanDef.getPropertyValues().add("messageConverter", messageConverter);
String name = MESSAGING_TEMPLATE_BEAN_NAME;
registerBeanDefByName(name, beanDef, context, source);
return new RuntimeBeanReference(name);
}
use of org.springframework.beans.factory.config.RuntimeBeanReference in project spring-framework by spring-projects.
the class WebSocketNamespaceUtils method registerHandshakeHandler.
public static RuntimeBeanReference registerHandshakeHandler(Element element, ParserContext context, Object source) {
RuntimeBeanReference handlerRef;
Element handlerElem = DomUtils.getChildElementByTagName(element, "handshake-handler");
if (handlerElem != null) {
handlerRef = new RuntimeBeanReference(handlerElem.getAttribute("ref"));
} else {
RootBeanDefinition defaultHandlerDef = new RootBeanDefinition(DefaultHandshakeHandler.class);
defaultHandlerDef.setSource(source);
defaultHandlerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
String handlerName = context.getReaderContext().registerWithGeneratedName(defaultHandlerDef);
handlerRef = new RuntimeBeanReference(handlerName);
}
return handlerRef;
}
use of org.springframework.beans.factory.config.RuntimeBeanReference in project spring-framework by spring-projects.
the class WebSocketNamespaceUtils method registerScheduler.
public static RuntimeBeanReference registerScheduler(String schedulerName, ParserContext context, Object source) {
if (!context.getRegistry().containsBeanDefinition(schedulerName)) {
RootBeanDefinition taskSchedulerDef = new RootBeanDefinition(ThreadPoolTaskScheduler.class);
taskSchedulerDef.setSource(source);
taskSchedulerDef.setRole(BeanDefinition.ROLE_INFRASTRUCTURE);
taskSchedulerDef.getPropertyValues().add("poolSize", Runtime.getRuntime().availableProcessors());
taskSchedulerDef.getPropertyValues().add("threadNamePrefix", schedulerName + "-");
taskSchedulerDef.getPropertyValues().add("removeOnCancelPolicy", true);
context.getRegistry().registerBeanDefinition(schedulerName, taskSchedulerDef);
context.registerComponent(new BeanComponentDefinition(taskSchedulerDef, schedulerName));
}
return new RuntimeBeanReference(schedulerName);
}
use of org.springframework.beans.factory.config.RuntimeBeanReference in project redisson by redisson.
the class DelayedQueueDecorator method decorate.
@Override
public void decorate(Element element, ParserContext parserContext, BeanDefinitionBuilder builder, RedissonNamespaceParserSupport helper) {
Assert.state(element.hasAttribute(DESTINATION_QUEUE_REF), "Illegal state. property \"" + DESTINATION_QUEUE_REF + "\" is required in the \"" + helper.getName(element) + "\" element.");
helper.addConstructorArgs(new RuntimeBeanReference(helper.getAttribute(element, DESTINATION_QUEUE_REF)), RQueue.class, builder);
}
Aggregations