Created
March 26, 2014 18:55
-
-
Save vvasabi/9790659 to your computer and use it in GitHub Desktop.
Instead of being able to override properties in any beans, this variant of PropertyOverrideConfigurer restricts property overriding to just 1 specified bean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import org.springframework.beans.BeansException; | |
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; | |
import org.springframework.beans.factory.config.PropertyOverrideConfigurer; | |
public class BeanPropertyOverrideConfigurer extends PropertyOverrideConfigurer { | |
private String beanName; | |
public String getBeanName() { | |
return beanName; | |
} | |
public void setBeanName(String beanName) { | |
this.beanName = beanName; | |
} | |
@Override | |
protected void processKey(ConfigurableListableBeanFactory factory, String key, String value) | |
throws BeansException { | |
applyPropertyValue(factory, beanName, key, value); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment