本文整理汇总了Java中org.springframework.beans.factory.config.RuntimeBeanReference.getBeanName方法的典型用法代码示例。如果您正苦于以下问题:Java RuntimeBeanReference.getBeanName方法的具体用法?Java RuntimeBeanReference.getBeanName怎么用?Java RuntimeBeanReference.getBeanName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.factory.config.RuntimeBeanReference
的用法示例。
在下文中一共展示了RuntimeBeanReference.getBeanName方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addRefIfNeeded
import org.springframework.beans.factory.config.RuntimeBeanReference; //导入方法依赖的package包/类
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());
}
}
示例2: resolveReference
import org.springframework.beans.factory.config.RuntimeBeanReference; //导入方法依赖的package包/类
/**
* 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);
}
}
示例3: registerWebSocketMessageBrokerStats
import org.springframework.beans.factory.config.RuntimeBeanReference; //导入方法依赖的package包/类
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);
}
示例4: resolveReference
import org.springframework.beans.factory.config.RuntimeBeanReference; //导入方法依赖的package包/类
/**
* 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);
}
}