How do you configure a Spring bean container to load a Java property file?

前端 未结 6 1037
囚心锁ツ
囚心锁ツ 2021-02-02 01:48

How do you configure a Spring bean container (or application context) to load a Java property file?

JavaWorld article Smartly Load Your Properties explains how to load p

6条回答
  •  礼貌的吻别
    2021-02-02 02:42

    There's this thing called a PropertyPlaceholderConfigurer, you can use it to inject your beans with values from a properties file, like this:

    
        
            classpath:com/foo/jdbc.properties
        
    
    
    
        
        
        
        
    
    

提交回复
热议问题