Java Code Examples for org.springframework.beans.PropertyValue#setOptional()

The following examples show how to use org.springframework.beans.PropertyValue#setOptional() . 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: PropertyOverrideConfigurer.java    From spring-analysis-note with MIT License 5 votes vote down vote up
/**
 * Apply the given property value to the corresponding bean.
 */
protected void applyPropertyValue(
		ConfigurableListableBeanFactory factory, String beanName, String property, String value) {

	BeanDefinition bd = factory.getBeanDefinition(beanName);
	BeanDefinition bdToUse = bd;
	while (bd != null) {
		bdToUse = bd;
		bd = bd.getOriginatingBeanDefinition();
	}
	PropertyValue pv = new PropertyValue(property, value);
	pv.setOptional(this.ignoreInvalidKeys);
	bdToUse.getPropertyValues().addPropertyValue(pv);
}
 
Example 2
Source File: PropertyOverrideConfigurer.java    From java-technology-stack with MIT License 5 votes vote down vote up
/**
 * Apply the given property value to the corresponding bean.
 */
protected void applyPropertyValue(
		ConfigurableListableBeanFactory factory, String beanName, String property, String value) {

	BeanDefinition bd = factory.getBeanDefinition(beanName);
	BeanDefinition bdToUse = bd;
	while (bd != null) {
		bdToUse = bd;
		bd = bd.getOriginatingBeanDefinition();
	}
	PropertyValue pv = new PropertyValue(property, value);
	pv.setOptional(this.ignoreInvalidKeys);
	bdToUse.getPropertyValues().addPropertyValue(pv);
}
 
Example 3
Source File: PropertyOverrideConfigurer.java    From lams with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Apply the given property value to the corresponding bean.
 */
protected void applyPropertyValue(
		ConfigurableListableBeanFactory factory, String beanName, String property, String value) {

	BeanDefinition bd = factory.getBeanDefinition(beanName);
	while (bd.getOriginatingBeanDefinition() != null) {
		bd = bd.getOriginatingBeanDefinition();
	}
	PropertyValue pv = new PropertyValue(property, value);
	pv.setOptional(this.ignoreInvalidKeys);
	bd.getPropertyValues().addPropertyValue(pv);
}
 
Example 4
Source File: PropertyOverrideConfigurer.java    From blog_demos with Apache License 2.0 5 votes vote down vote up
/**
 * Apply the given property value to the corresponding bean.
 */
protected void applyPropertyValue(
		ConfigurableListableBeanFactory factory, String beanName, String property, String value) {

	BeanDefinition bd = factory.getBeanDefinition(beanName);
	while (bd.getOriginatingBeanDefinition() != null) {
		bd = bd.getOriginatingBeanDefinition();
	}
	PropertyValue pv = new PropertyValue(property, value);
	pv.setOptional(this.ignoreInvalidKeys);
	bd.getPropertyValues().addPropertyValue(pv);
}
 
Example 5
Source File: PropertyOverrideConfigurer.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
/**
 * Apply the given property value to the corresponding bean.
 */
protected void applyPropertyValue(
		ConfigurableListableBeanFactory factory, String beanName, String property, String value) {

	BeanDefinition bd = factory.getBeanDefinition(beanName);
	while (bd.getOriginatingBeanDefinition() != null) {
		bd = bd.getOriginatingBeanDefinition();
	}
	PropertyValue pv = new PropertyValue(property, value);
	pv.setOptional(this.ignoreInvalidKeys);
	bd.getPropertyValues().addPropertyValue(pv);
}
 
Example 6
Source File: ConfigurationBeanDefinitionHelper.java    From conf4j with MIT License 2 votes vote down vote up
/**
 * Add to the bean definition an indicator which says the definition is a conf4j configuration.
 *
 * @param beanDefinition         bean definition
 * @param configurationIndicator configuration indicator
 * @throws NullPointerException when {@code beanDefinition} is {@code null}.
 */
public static void addConf4jConfigurationIndicator(BeanDefinition beanDefinition, ConfigurationIndicator configurationIndicator) {
    PropertyValue conf4jConfigurationIndicator = new PropertyValue(CONF4J_CONFIGURATION_INDICATOR, configurationIndicator);
    conf4jConfigurationIndicator.setOptional(true);
    beanDefinition.getPropertyValues().addPropertyValue(conf4jConfigurationIndicator);
}