Multiple properties files in Spring 3.0

前端 未结 3 1265
轮回少年
轮回少年 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 20:52

    Following code snippet should get you started

    
        
        
        
        
            
                classpath*:config/*/config1/*.properties
                classpath*:config/*/config2/*.properties
                classpath*:config/*/config3/*.properties
                classpath*:custom.properties
            
        
         
    

    You may store the property files in following hierarchy making sure config is reachable from via classpath

    config
      config1
         a.properties
      config2
         b.properties
      config3
         c.properties
    custom.properties
    

提交回复
热议问题