1
我正在使用PropertyPlaceholderConfigurer加载属性值? 有没有办法在运行时更改一些属性? Spring框架中是否存在自动化的方式?如何在运行时更改属性值
我正在使用PropertyPlaceholderConfigurer加载属性值? 有没有办法在运行时更改一些属性? Spring框架中是否存在自动化的方式?如何在运行时更改属性值
有没有办法改变的春天bean定义的属性在运行时间。但你可以在preparation.You期间动态添加的属性可以覆盖PropertyPlaceholderConfigurer这样,
public class SpringPropertiesLoader extends PropertyPlaceholderConfigurer {
@Override
protected void loadProperties(Properties props) throws IOException {
super.loadProperties(props);
props.put("myProp","myValue");
}
}
,然后,使用该类,而不是Spring xml中的PropertyPlaceholderConfigurer。