use of org.springframework.beans.factory.config.BeanDefinitionHolder in project camunda-bpm-platform by camunda.
the class Scopifier method createScopedProxy.
public static BeanDefinitionHolder createScopedProxy(String beanName, BeanDefinition definition, BeanDefinitionRegistry registry, boolean proxyTargetClass) {
BeanDefinitionHolder proxyHolder = ScopedProxyUtils.createScopedProxy(new BeanDefinitionHolder(definition, beanName), registry, proxyTargetClass);
registry.registerBeanDefinition(beanName, proxyHolder.getBeanDefinition());
return proxyHolder;
}
use of org.springframework.beans.factory.config.BeanDefinitionHolder in project camunda-bpm-platform by camunda.
the class Scopifier method resolveValue.
@Override
protected Object resolveValue(Object value) {
BeanDefinition definition = null;
String beanName = null;
if (value instanceof BeanDefinition) {
definition = (BeanDefinition) value;
beanName = BeanDefinitionReaderUtils.generateBeanName(definition, registry);
} else if (value instanceof BeanDefinitionHolder) {
BeanDefinitionHolder holder = (BeanDefinitionHolder) value;
definition = holder.getBeanDefinition();
beanName = holder.getBeanName();
}
if (definition != null) {
boolean nestedScoped = scope.equals(definition.getScope());
boolean scopeChangeRequiresProxy = !scoped && nestedScoped;
if (scopeChangeRequiresProxy) {
// analysed
return createScopedProxy(beanName, definition, registry, proxyTargetClass);
}
}
// Nested inner bean definitions are recursively analysed here
value = super.resolveValue(value);
return value;
}
use of org.springframework.beans.factory.config.BeanDefinitionHolder in project ff4j by ff4j.
the class FF4JPlaceHolderBeanDefinitionParser method parse.
/**
* {@inheritDoc}
*/
public final BeanDefinition parse(Element element, ParserContext parserContext) {
logger.debug("Initialization from <ff4j:" + TAG_PLACEHOLDER + "> TAG");
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition();
builder.getRawBeanDefinition().setBeanClass(FF4jPropertiesPlaceHolderConfigurer.class);
builder.getRawBeanDefinition().setSource(parserContext.extractSource(element));
// Reference to FF4J bean
RuntimeBeanReference refFF4j = new RuntimeBeanReference("ff4j");
builder.getBeanDefinition().getPropertyValues().addPropertyValue("id", BEANID_PLACEHOLDER_CONF);
builder.getBeanDefinition().getPropertyValues().addPropertyValue("ff4j", refFF4j);
builder.getBeanDefinition().getPropertyValues().addPropertyValue("order", 2);
AbstractBeanDefinition def = builder.getBeanDefinition();
if (def != null && !parserContext.isNested()) {
BeanDefinitionHolder holder = new BeanDefinitionHolder(def, BEANID_PLACEHOLDER, new String[0]);
BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
}
return def;
}
use of org.springframework.beans.factory.config.BeanDefinitionHolder in project hazelcast by hazelcast.
the class HazelcastClientBeanDefinitionParser method registerCPSubsystemBean.
private void registerCPSubsystemBean(Element element, ParserContext parserContext) {
String instanceBeanRef = element.getAttribute("id");
BeanDefinitionBuilder cpBeanDefBuilder = BeanDefinitionBuilder.rootBeanDefinition(CPSubsystem.class);
cpBeanDefBuilder.setFactoryMethodOnBean("getCPSubsystem", instanceBeanRef);
cpBeanDefBuilder.setLazyInit(true);
BeanDefinitionHolder holder = new BeanDefinitionHolder(cpBeanDefBuilder.getBeanDefinition(), instanceBeanRef + CP_SUBSYSTEM_SUFFIX);
registerBeanDefinition(holder, parserContext.getRegistry());
}
use of org.springframework.beans.factory.config.BeanDefinitionHolder in project geronimo-xbean by apache.
the class XBeanNamespaceHandler method parse.
public BeanDefinition parse(Element element, ParserContext parserContext) {
this.parserContext = parserContext;
this.qnameHelper = new XBeanQNameHelper(parserContext.getReaderContext());
BeanDefinitionHolder holder = parseBeanFromExtensionElement(element);
// a 2nd level could be a nested <beans> from Spring 3.1 onwards
if (element.getParentNode() == element.getOwnerDocument() || element.getParentNode().getParentNode() == element.getOwnerDocument() || element.getParentNode().getParentNode().getParentNode() == element.getOwnerDocument()) {
BeanDefinitionReaderUtils.registerBeanDefinition(holder, parserContext.getRegistry());
BeanComponentDefinition componentDefinition = new BeanComponentDefinition(holder);
parserContext.getReaderContext().fireComponentRegistered(componentDefinition);
}
return holder.getBeanDefinition();
}
Aggregations