Multiple properties files in Spring 3.0

前端 未结 3 1268
轮回少年
轮回少年 2020-12-13 20:25

I am working on a project with several separate modules, each with their own application context properties files. I want to be able to load all these properties so that the

3条回答
  •  不思量自难忘°
    2020-12-13 21:05

    You can collect multiple property files into one bean quite easily:

    
      
      
      
        
          classpath*:default.properties
          classpath*:overrides.properties
          file:${APP_HOME}/**/*.properties
        
      
    
    

    This particular example will gather all default.properties, overrides.properties on classpath and property files in your APP_HOME. Now you can refer to this bean from ProperyPlaceholderConfigurer or your custom postprocessor.

提交回复
热议问题