Search in sources :

Example 11 with BeanDefinitionBuilder

use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.

the class SimpleJobBeanDefinitionParser method getJobTypeConfigurationBeanDefinition.

@Override
protected BeanDefinition getJobTypeConfigurationBeanDefinition(final BeanDefinition jobCoreConfigurationBeanDefinition, final Element element) {
    BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(SimpleJobConfiguration.class);
    result.addConstructorArgValue(jobCoreConfigurationBeanDefinition);
    result.addConstructorArgValue(element.getAttribute(CLASS_ATTRIBUTE));
    return result.getBeanDefinition();
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder)

Example 12 with BeanDefinitionBuilder

use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project sharding-jdbc by dangdangdotcom.

the class MasterSlaveDataSourceBeanDefinitionParser method parseInternal.

@Override
protected //CHECKSTYLE:OFF
AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
    //CHECKSTYLE:ON
    BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(MasterSlaveDataSource.class);
    factory.addConstructorArgValue(parseId(element));
    factory.addConstructorArgReference(parseMasterDataSourceRef(element));
    factory.addConstructorArgValue(parseSlaveDataSources(element, parserContext));
    return factory.getBeanDefinition();
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder)

Example 13 with BeanDefinitionBuilder

use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.

the class ZookeeperBeanDefinitionParser method parseInternal.

@Override
protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) {
    BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(ZookeeperRegistryCenter.class);
    result.addConstructorArgValue(buildZookeeperConfigurationBeanDefinition(element));
    result.setInitMethodName("init");
    return result.getBeanDefinition();
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder)

Example 14 with BeanDefinitionBuilder

use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project elastic-job by dangdangdotcom.

the class ZookeeperBeanDefinitionParser method buildZookeeperConfigurationBeanDefinition.

private AbstractBeanDefinition buildZookeeperConfigurationBeanDefinition(final Element element) {
    BeanDefinitionBuilder configuration = BeanDefinitionBuilder.rootBeanDefinition(ZookeeperConfiguration.class);
    configuration.addConstructorArgValue(element.getAttribute("server-lists"));
    configuration.addConstructorArgValue(element.getAttribute("namespace"));
    addPropertyValueIfNotEmpty("base-sleep-time-milliseconds", "baseSleepTimeMilliseconds", element, configuration);
    addPropertyValueIfNotEmpty("max-sleep-time-milliseconds", "maxSleepTimeMilliseconds", element, configuration);
    addPropertyValueIfNotEmpty("max-retries", "maxRetries", element, configuration);
    addPropertyValueIfNotEmpty("session-timeout-milliseconds", "sessionTimeoutMilliseconds", element, configuration);
    addPropertyValueIfNotEmpty("connection-timeout-milliseconds", "connectionTimeoutMilliseconds", element, configuration);
    addPropertyValueIfNotEmpty("digest", "digest", element, configuration);
    return configuration.getBeanDefinition();
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder)

Example 15 with BeanDefinitionBuilder

use of org.springframework.beans.factory.support.BeanDefinitionBuilder in project opennms by OpenNMS.

the class ReferenceListBeanDefinitionParser method parseListener.

private BeanDefinitionBuilder parseListener(Element element) {
    BeanDefinitionBuilder listener = BeanDefinitionBuilder.rootBeanDefinition(RegistrationListenerBean.class);
    listener.addPropertyReference("target", element.getAttribute("ref"));
    listener.addPropertyValue("serviceInterface", m_serviceInterface);
    listener.addPropertyValue("bindMethod", element.getAttribute("bind-method"));
    listener.addPropertyValue("unbindMethod", element.getAttribute("unbind-method"));
    return listener;
}
Also used : BeanDefinitionBuilder(org.springframework.beans.factory.support.BeanDefinitionBuilder)

Aggregations

BeanDefinitionBuilder (org.springframework.beans.factory.support.BeanDefinitionBuilder)539 BeanDefinition (org.springframework.beans.factory.config.BeanDefinition)115 Element (org.w3c.dom.Element)99 RuntimeBeanReference (org.springframework.beans.factory.config.RuntimeBeanReference)60 RootBeanDefinition (org.springframework.beans.factory.support.RootBeanDefinition)60 AbstractBeanDefinition (org.springframework.beans.factory.support.AbstractBeanDefinition)59 BeanMetadataElement (org.springframework.beans.BeanMetadataElement)53 BeanComponentDefinition (org.springframework.beans.factory.parsing.BeanComponentDefinition)47 ManagedList (org.springframework.beans.factory.support.ManagedList)33 ManagedMap (org.springframework.beans.factory.support.ManagedMap)29 HashMap (java.util.HashMap)19 DefaultListableBeanFactory (org.springframework.beans.factory.support.DefaultListableBeanFactory)19 Test (org.junit.jupiter.api.Test)16 BeanDefinitionHolder (org.springframework.beans.factory.config.BeanDefinitionHolder)16 BeanDefinitionRegistry (org.springframework.beans.factory.support.BeanDefinitionRegistry)12 Node (org.w3c.dom.Node)12 ArrayList (java.util.ArrayList)11 Test (org.junit.Test)10 TypedStringValue (org.springframework.beans.factory.config.TypedStringValue)10 CompositeComponentDefinition (org.springframework.beans.factory.parsing.CompositeComponentDefinition)10