Is it possible to have multiple PropertyPlaceHolderConfigurer in my applicationContext?

前端 未结 8 1296
臣服心动
臣服心动 2020-12-01 01:16

I need to load a specific applicationContext.xml file according to a given system property. This itself loads a file with the actual configuration. Therefore I need 2 Proper

8条回答
  •  青春惊慌失措
    2020-12-01 01:49

    You can't do this directly, and this JIRA issue from Spring explains why (check the comment from Chris Beams for a detailed explanation):

    https://jira.springsource.org/browse/SPR-6428

    However, he does provide a workaround using Spring 3.1 or later, which is to use the PropertySourcesPlaceholderConfigurer class instead of PropertyPlaceholderConfigurer class.

    You can download a Maven-based project that demonstrates the problem and the solution from the Spring framework issues github:

    https://github.com/SpringSource/spring-framework-issues

    Look for the issue number, SPR-6428, in the downloaded projects.

提交回复
热议问题