spring property substitution for test and production

前端 未结 5 1150
余生分开走
余生分开走 2020-11-30 19:40

I ran into this for property substitution in spring


but u

5条回答
  •  天命终不由人
    2020-11-30 19:59

    • On the context tag you can indicate that if a properties file does not exist it does not need to fail.
    • Property files are loaded in the order that they are declared. (This might also be a property to declare on the tag. Not sure)
    • If a property is declared multiple times, the last loaded value is used.

    We use these three features as follows:

    We declare two property files:

    classpath:esb-project-config.properties,
    classpath:esb-project-config-override.properties
    

    The first property file contains sensible defaults and development configuration. This file is part of your application.

    The second property file is a file that is available on the test classpath or even the production classpath of the application server. This file is external of the application That way we can override properties for each environment and have just one version of our application.

    So here is the example of the properties we use:

        
    

提交回复
热议问题