Java Code Examples for org.springframework.beans.factory.support.BeanDefinitionBuilder#addConstructorArgReference()
The following examples show how to use
org.springframework.beans.factory.support.BeanDefinitionBuilder#addConstructorArgReference() .
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: EncryptablePropertyPlaceholderBeanDefinitionParser.java From jasypt with Apache License 2.0 | 6 votes |
@Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.addPropertyValue("ignoreUnresolvablePlaceholders", Boolean.valueOf(element.getAttribute("ignore-unresolvable"))); String systemPropertiesModeName = element.getAttribute("system-properties-mode"); if (StringUtils.hasLength(systemPropertiesModeName) && !systemPropertiesModeName.equals(SYSTEM_PROPERTIES_MODE_DEFAULT)) { builder.addPropertyValue("systemPropertiesModeName", "SYSTEM_PROPERTIES_MODE_"+systemPropertiesModeName); } final String encryptorBeanName = element.getAttribute(ENCRYPTOR_ATTRIBUTE); if (StringUtils.hasText(encryptorBeanName)) { builder.addConstructorArgReference(encryptorBeanName); } }
Example 2
Source File: EncryptablePropertyOverrideBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
@Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.addPropertyValue("ignoreInvalidKeys", Boolean.valueOf(element.getAttribute("ignore-unresolvable"))); final String encryptorBeanName = element.getAttribute(ENCRYPTOR_ATTRIBUTE); if (StringUtils.hasText(encryptorBeanName)) { builder.addConstructorArgReference(encryptorBeanName); } }
Example 3
Source File: DataSourceBeanDefinitionParser.java From shardingsphere with Apache License 2.0 | 5 votes |
private void configureFactory(final Element element, final BeanDefinitionBuilder factory) { String dataSourceName = element.getAttribute(DataSourceBeanDefinitionTag.DATA_SOURCE_REF_TAG); if (!Strings.isNullOrEmpty(dataSourceName)) { factory.addConstructorArgReference(dataSourceName); } factory.addConstructorArgValue(getOrchestrationConfiguration(element)); String cluster = element.getAttribute(DataSourceBeanDefinitionTag.CLUSTER_REF_TAG); if (!Strings.isNullOrEmpty(cluster)) { factory.addConstructorArgReference(cluster); } }
Example 4
Source File: ScheduledTasksBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private RuntimeBeanReference triggerTaskReference(String runnableBeanName, String triggerBeanName, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.config.TriggerTask"); builder.addConstructorArgReference(runnableBeanName); builder.addConstructorArgReference(triggerBeanName); return beanReference(taskElement, parserContext, builder); }
Example 5
Source File: ScheduledTasksBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private RuntimeBeanReference cronTaskReference(String runnableBeanName, String cronExpression, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.config.CronTask"); builder.addConstructorArgReference(runnableBeanName); builder.addConstructorArgValue(cronExpression); return beanReference(taskElement, parserContext, builder); }
Example 6
Source File: ScheduledTasksBeanDefinitionParser.java From java-technology-stack with MIT License | 5 votes |
private RuntimeBeanReference intervalTaskReference(String runnableBeanName, String initialDelay, String interval, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.config.IntervalTask"); builder.addConstructorArgReference(runnableBeanName); builder.addConstructorArgValue(interval); builder.addConstructorArgValue(StringUtils.hasLength(initialDelay) ? initialDelay : ZERO_INITIAL_DELAY); return beanReference(taskElement, parserContext, builder); }
Example 7
Source File: ZookeeperConfigGroupConfigBean.java From config-toolkit with Apache License 2.0 | 5 votes |
@Override protected void doParse(Element element, BeanDefinitionBuilder builder) { String configProfileRef = element.getAttribute("config-profile-ref"); builder.addConstructorArgReference(configProfileRef); String node = element.getAttribute("node"); builder.addConstructorArgValue(node); }
Example 8
Source File: EncryptablePropertyOverrideBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
@Override protected void doParse(final Element element, final BeanDefinitionBuilder builder) { super.doParse(element, builder); builder.addPropertyValue("ignoreInvalidKeys", Boolean.valueOf(element.getAttribute("ignore-unresolvable"))); final String encryptorBeanName = element.getAttribute(ENCRYPTOR_ATTRIBUTE); if (StringUtils.hasText(encryptorBeanName)) { builder.addConstructorArgReference(encryptorBeanName); } }
Example 9
Source File: RedissonDefinitionParser.java From redisson with Apache License 2.0 | 5 votes |
@Override public BeanDefinition parse(Element element, ParserContext parserContext) { //Sort out the Config Class BeanDefinitionBuilder configBuilder = helper.createBeanDefinitionBuilder(element, parserContext, Config.class); String configId = helper.getId(null, configBuilder, parserContext); helper.parseAttributes(element, parserContext, configBuilder); helper.registerBeanDefinition(configBuilder, configId, null, parserContext); //Do the main Redisson bean BeanDefinitionBuilder builder = helper.createBeanDefinitionBuilder(element, parserContext, Redisson.class); builder.setFactoryMethod("create"); builder.setDestroyMethodName("shutdown"); builder.addConstructorArgReference(configId); parserContext.getDelegate().parseQualifierElements(element, builder.getRawBeanDefinition()); String id = helper.getId(element, builder, parserContext); helper.parseAttributes(element, parserContext, configBuilder); //Sort out all the nested elements parseChildElements(element, configId, id, builder, parserContext); helper.registerBeanDefinition(builder, id, helper.parseAliase(element), parserContext); return builder.getBeanDefinition(); }
Example 10
Source File: MybatisAuditingRegistrar.java From spring-data-mybatis with Apache License 2.0 | 5 votes |
@Override protected BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder( AuditingConfiguration configuration) { Assert.notNull(configuration, "AuditingConfiguration must not be null!"); BeanDefinitionBuilder builder = configureDefaultAuditHandlerAttributes( configuration, BeanDefinitionBuilder.rootBeanDefinition(MybatisAuditingHandler.class)); return builder.addConstructorArgReference(MYBATIS_MAPPING_CONTEXT_BEAN_NAME); }
Example 11
Source File: BeanRegistrar.java From spring-batch-lightmin with Apache License 2.0 | 5 votes |
private void addConstructorArgReferences( final BeanDefinitionBuilder builder, final Set<String> constructorReferences) { if (constructorReferences != null) { for (final String beanName : constructorReferences) { builder.addConstructorArgReference(beanName); } } }
Example 12
Source File: ScheduledTasksBeanDefinitionParser.java From spring4-understanding with Apache License 2.0 | 5 votes |
private RuntimeBeanReference runnableReference(String ref, String method, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.support.ScheduledMethodRunnable"); builder.addConstructorArgReference(ref); builder.addConstructorArgValue(method); return beanReference(taskElement, parserContext, builder); }
Example 13
Source File: AmazonWebserviceClientConfigurationUtils.java From spring-cloud-aws with Apache License 2.0 | 5 votes |
public static AbstractBeanDefinition getAmazonWebserviceClientBeanDefinition( Object source, String serviceNameClassName, String customRegionProvider, String customRegion, BeanDefinitionRegistry beanDefinitionRegistry) { if (StringUtils.hasText(customRegionProvider) && StringUtils.hasText(customRegion)) { throw new IllegalArgumentException( "Only region or regionProvider can be configured, but not both"); } registerCredentialsProviderIfNeeded(beanDefinitionRegistry); BeanDefinitionBuilder builder = BeanDefinitionBuilder .rootBeanDefinition(AmazonWebserviceClientFactoryBean.class); // Configure constructor parameters builder.addConstructorArgValue(serviceNameClassName); builder.addConstructorArgReference(CREDENTIALS_PROVIDER_BEAN_NAME); // Configure source of the bean definition builder.getRawBeanDefinition().setSource(source); // Configure region properties (either custom region provider or custom region) if (StringUtils.hasText(customRegionProvider)) { builder.addPropertyReference("regionProvider", customRegionProvider); } else if (StringUtils.hasText(customRegion)) { builder.addPropertyValue("customRegion", customRegion); } else { registerRegionProviderBeanIfNeeded(beanDefinitionRegistry); builder.addPropertyReference("regionProvider", REGION_PROVIDER_BEAN_NAME); } return builder.getBeanDefinition(); }
Example 14
Source File: ScheduledTasksBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private RuntimeBeanReference intervalTaskReference(String runnableBeanName, String initialDelay, String interval, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.config.IntervalTask"); builder.addConstructorArgReference(runnableBeanName); builder.addConstructorArgValue(interval); builder.addConstructorArgValue(StringUtils.hasLength(initialDelay) ? initialDelay : ZERO_INITIAL_DELAY); return beanReference(taskElement, parserContext, builder); }
Example 15
Source File: ScheduledTasksBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private RuntimeBeanReference runnableReference(String ref, String method, Element taskElement, ParserContext parserContext) { BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition( "org.springframework.scheduling.support.ScheduledMethodRunnable"); builder.addConstructorArgReference(ref); builder.addConstructorArgValue(method); return beanReference(taskElement, parserContext, builder); }
Example 16
Source File: AbstractJobBeanDefinitionParser.java From shardingsphere-elasticjob-lite with Apache License 2.0 | 5 votes |
@SneakyThrows @Override protected final AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) { BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(JobScheduler.class); factory.setInitMethodName("init"); factory.addConstructorArgReference(element.getAttribute(BaseJobBeanDefinitionParserTag.REGISTRY_CENTER_REF_ATTRIBUTE)); factory.addConstructorArgReference(element.getAttribute(BaseJobBeanDefinitionParserTag.JOB_REF_ATTRIBUTE)); factory.addConstructorArgValue(createJobConfiguration(element)); BeanDefinition tracingConfig = createTracingConfiguration(element); if (null != tracingConfig) { factory.addConstructorArgValue(tracingConfig); } factory.addConstructorArgValue(createJobListeners(element)); return factory.getBeanDefinition(); }
Example 17
Source File: ShardingRuleBeanDefinitionParser.java From shardingsphere with Apache License 2.0 | 5 votes |
private void addDefaultDatabaseShardingStrategyRef(final Element element, final BeanDefinitionBuilder factory) { Optional<String> strategyRef = parseStrategyRef(element, ShardingRuleBeanDefinitionTag.DEFAULT_DATABASE_STRATEGY_REF_ATTRIBUTE); if (strategyRef.isPresent()) { factory.addConstructorArgReference(strategyRef.get()); } else { factory.addConstructorArgValue(null); } }
Example 18
Source File: AbstractStoreBeanDefinitionRegistrar.java From spring-content with Apache License 2.0 | 4 votes |
private void registerStoreFragment(BeanDefinitionRegistry registry, AnnotationMetadata source, StoreFragmentDefinition fragmentDefinition) { String implementationBeanName = fragmentDefinition.getImplementationBeanName(); String fragmentBeanName = fragmentDefinition.getFragmentBeanName(); if (registry.containsBeanDefinition(fragmentBeanName)) { return; } BeanDefinitionBuilder fragmentBuilder = BeanDefinitionBuilder.genericBeanDefinition(StoreFragment.class); fragmentBuilder.addConstructorArgValue(fragmentDefinition.getInterfaceName()); fragmentBuilder.addConstructorArgReference(implementationBeanName); registry.registerBeanDefinition(fragmentBeanName, ParsingUtils.getSourceBeanDefinition(fragmentBuilder, source)); }
Example 19
Source File: AbstractDataBaseBean.java From spring-boot-starter-dao with Apache License 2.0 | 4 votes |
protected final AbstractBeanDefinition createTransactionManager(String dataSourceName) { BeanDefinitionBuilder bdb = BeanDefinitionBuilder.genericBeanDefinition(DataSourceTransactionManager.class); bdb.addConstructorArgReference(dataSourceName); return bdb.getRawBeanDefinition(); }
Example 20
Source File: DatastoreAuditingRegistrar.java From spring-cloud-gcp with Apache License 2.0 | 4 votes |
@Override protected BeanDefinitionBuilder getAuditHandlerBeanDefinitionBuilder(AuditingConfiguration configuration) { BeanDefinitionBuilder builder = configureDefaultAuditHandlerAttributes(configuration, BeanDefinitionBuilder.rootBeanDefinition(AuditingHandler.class)); return builder.addConstructorArgReference(MAPPING_CONTEXT_BEAN_NAME); }