Java Code Examples for org.springframework.beans.factory.config.RuntimeBeanReference#getBeanName()
The following examples show how to use
org.springframework.beans.factory.config.RuntimeBeanReference#getBeanName() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MessageBrokerBeanDefinitionParser.java From spring-analysis-note with MIT License | 6 votes |
private void registerWebSocketMessageBrokerStats(RootBeanDefinition broker, RuntimeBeanReference inChannel, RuntimeBeanReference outChannel, ParserContext context, @Nullable Object source) { RootBeanDefinition beanDef = new RootBeanDefinition(WebSocketMessageBrokerStats.class); RuntimeBeanReference webSocketHandler = new RuntimeBeanReference(WEB_SOCKET_HANDLER_BEAN_NAME); beanDef.getPropertyValues().add("subProtocolWebSocketHandler", webSocketHandler); if (StompBrokerRelayMessageHandler.class == broker.getBeanClass()) { beanDef.getPropertyValues().add("stompBrokerRelay", broker); } String name = inChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("inboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } name = outChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("outboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } Object scheduler = WebSocketNamespaceUtils.registerScheduler(SCHEDULER_BEAN_NAME, context, source); beanDef.getPropertyValues().add("sockJsTaskScheduler", scheduler); registerBeanDefByName("webSocketMessageBrokerStats", beanDef, context, source); }
Example 2
Source File: MessageBrokerBeanDefinitionParser.java From java-technology-stack with MIT License | 6 votes |
private void registerWebSocketMessageBrokerStats(RootBeanDefinition broker, RuntimeBeanReference inChannel, RuntimeBeanReference outChannel, ParserContext context, @Nullable Object source) { RootBeanDefinition beanDef = new RootBeanDefinition(WebSocketMessageBrokerStats.class); RuntimeBeanReference webSocketHandler = new RuntimeBeanReference(WEB_SOCKET_HANDLER_BEAN_NAME); beanDef.getPropertyValues().add("subProtocolWebSocketHandler", webSocketHandler); if (StompBrokerRelayMessageHandler.class == broker.getBeanClass()) { beanDef.getPropertyValues().add("stompBrokerRelay", broker); } String name = inChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("inboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } name = outChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("outboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } Object scheduler = WebSocketNamespaceUtils.registerScheduler(SCHEDULER_BEAN_NAME, context, source); beanDef.getPropertyValues().add("sockJsTaskScheduler", scheduler); registerBeanDefByName("webSocketMessageBrokerStats", beanDef, context, source); }
Example 3
Source File: ContextDependencyLister.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
private void addRefIfNeeded(Object v, List<String> refs) { if(v == null) return; if(v instanceof RuntimeBeanReference) { RuntimeBeanReference r = (RuntimeBeanReference)v; String name = r.getBeanName(); addRefIfNeeded(name, refs); if(name == null || name.length() == 0) { System.err.println("Warning - empty reference " + r); } } else if(v instanceof BeanDefinitionHolder) { // Nested bean definition BeanDefinitionHolder bdh = (BeanDefinitionHolder)v; processBeanDefinition(bdh.getBeanName(), bdh.getBeanDefinition()); } else if(v instanceof ManagedList<?>) { ManagedList<?> ml = (ManagedList<?>)v; for(Object le : ml) { addRefIfNeeded(le, refs); } // } else { // System.err.println(v.getClass()); } }
Example 4
Source File: BeanDefinitionValueResolver.java From lams with GNU General Public License v2.0 | 6 votes |
/** * Resolve a reference to another bean in the factory. */ private Object resolveReference(Object argName, RuntimeBeanReference ref) { try { String refName = ref.getBeanName(); refName = String.valueOf(doEvaluate(refName)); if (ref.isToParent()) { if (this.beanFactory.getParentBeanFactory() == null) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Can't resolve reference to bean '" + refName + "' in parent factory: no parent factory available"); } return this.beanFactory.getParentBeanFactory().getBean(refName); } else { Object bean = this.beanFactory.getBean(refName); this.beanFactory.registerDependentBean(refName, this.beanName); return bean; } } catch (BeansException ex) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Cannot resolve reference to bean '" + ref.getBeanName() + "' while setting " + argName, ex); } }
Example 5
Source File: BeanDefinitionValueResolver.java From blog_demos with Apache License 2.0 | 6 votes |
/** * Resolve a reference to another bean in the factory. */ private Object resolveReference(Object argName, RuntimeBeanReference ref) { try { String refName = ref.getBeanName(); refName = String.valueOf(evaluate(refName)); if (ref.isToParent()) { if (this.beanFactory.getParentBeanFactory() == null) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Can't resolve reference to bean '" + refName + "' in parent factory: no parent factory available"); } return this.beanFactory.getParentBeanFactory().getBean(refName); } else { Object bean = this.beanFactory.getBean(refName); this.beanFactory.registerDependentBean(refName, this.beanName); return bean; } } catch (BeansException ex) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Cannot resolve reference to bean '" + ref.getBeanName() + "' while setting " + argName, ex); } }
Example 6
Source File: MessageBrokerBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
private void registerWebSocketMessageBrokerStats(RootBeanDefinition broker, RuntimeBeanReference inChannel, RuntimeBeanReference outChannel, ParserContext context, Object source) { RootBeanDefinition beanDef = new RootBeanDefinition(WebSocketMessageBrokerStats.class); RuntimeBeanReference webSocketHandler = new RuntimeBeanReference(WEB_SOCKET_HANDLER_BEAN_NAME); beanDef.getPropertyValues().add("subProtocolWebSocketHandler", webSocketHandler); if (StompBrokerRelayMessageHandler.class == broker.getBeanClass()) { beanDef.getPropertyValues().add("stompBrokerRelay", broker); } String name = inChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("inboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } name = outChannel.getBeanName() + "Executor"; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("outboundChannelExecutor", context.getRegistry().getBeanDefinition(name)); } name = SCHEDULER_BEAN_NAME; if (context.getRegistry().containsBeanDefinition(name)) { beanDef.getPropertyValues().add("sockJsTaskScheduler", context.getRegistry().getBeanDefinition(name)); } registerBeanDefByName("webSocketMessageBrokerStats", beanDef, context, source); }
Example 7
Source File: BeanDefinitionValueResolver.java From spring4-understanding with Apache License 2.0 | 6 votes |
/** * Resolve a reference to another bean in the factory. */ private Object resolveReference(Object argName, RuntimeBeanReference ref) { try { String refName = ref.getBeanName(); refName = String.valueOf(doEvaluate(refName)); if (ref.isToParent()) { if (this.beanFactory.getParentBeanFactory() == null) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Can't resolve reference to bean '" + refName + "' in parent factory: no parent factory available"); } return this.beanFactory.getParentBeanFactory().getBean(refName); } else { Object bean = this.beanFactory.getBean(refName); this.beanFactory.registerDependentBean(refName, this.beanName); return bean; } } catch (BeansException ex) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Cannot resolve reference to bean '" + ref.getBeanName() + "' while setting " + argName, ex); } }
Example 8
Source File: BeanDefinitionValueResolver.java From spring-analysis-note with MIT License | 5 votes |
/** * Resolve a reference to another bean in the factory. */ @Nullable private Object resolveReference(Object argName, RuntimeBeanReference ref) { try { Object bean; String refName = ref.getBeanName(); refName = String.valueOf(doEvaluate(refName)); if (ref.isToParent()) { if (this.beanFactory.getParentBeanFactory() == null) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Can't resolve reference to bean '" + refName + "' in parent factory: no parent factory available"); } bean = this.beanFactory.getParentBeanFactory().getBean(refName); } else { // 注释 5.7 在这里加载引用的 bean bean = this.beanFactory.getBean(refName); this.beanFactory.registerDependentBean(refName, this.beanName); } if (bean instanceof NullBean) { bean = null; } return bean; } catch (BeansException ex) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Cannot resolve reference to bean '" + ref.getBeanName() + "' while setting " + argName, ex); } }
Example 9
Source File: BeanDefinitionValueResolver.java From java-technology-stack with MIT License | 5 votes |
/** * Resolve a reference to another bean in the factory. */ @Nullable private Object resolveReference(Object argName, RuntimeBeanReference ref) { try { Object bean; String refName = ref.getBeanName(); refName = String.valueOf(doEvaluate(refName)); if (ref.isToParent()) { if (this.beanFactory.getParentBeanFactory() == null) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Can't resolve reference to bean '" + refName + "' in parent factory: no parent factory available"); } bean = this.beanFactory.getParentBeanFactory().getBean(refName); } else { bean = this.beanFactory.getBean(refName); this.beanFactory.registerDependentBean(refName, this.beanName); } if (bean instanceof NullBean) { bean = null; } return bean; } catch (BeansException ex) { throw new BeanCreationException( this.beanDefinition.getResourceDescription(), this.beanName, "Cannot resolve reference to bean '" + ref.getBeanName() + "' while setting " + argName, ex); } }