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

前端 未结 6 1032
囚心锁ツ
囚心锁ツ 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:24

    The Spring Framework Reference Documentation (2.5.x) gives two examples of how to load a property file into a bean container, one before the release of version 2.5 and a more concise way using the function that was introduced in version 2.5:

    Before version 2.5:

    
    
      
    
    

    After version 2.5:

    
    
    

    Note that in order to use , you must declare the util namespace and schema location in the preamble at the top of your Spring XML configuration file:

    
    
    
    
    
    
    

提交回复
热议问题