在Spring 4应用程序中,我们正在扩展PropertySourcesPlaceholderConfigurer
在解析属性期间执行一些自定义任务。如何通过配置弹簧xml来延长弹簧
要注册Ø春季新的类(MyPropertyConfigurer
)我们用下面的类:
@Configuration
public class AppConfig {
@Bean
public static PropertySourcesPlaceholderConfigurer
propertySourcesPlaceholderConfigurer() {
return new MyPropertyConfigurer();
}
}
由于好奇心的问题,我可以加我的新豆与spring.xml
而不是使用@Configuration
注释春天吗?
是的,但我怎么能在'xml'定义'MyPropertyConfigurer'并把它作为'PropertySourcesPlaceholderConfigurer' –
请参阅http://stackoverflow.com/questions/15502383/spring-loading -propertysourcesplaceholderconfigurer从 - JBoss的上下文 – shankarsh15