Access properties file programmatically with Spring?

前端 未结 15 1649
说谎
说谎 2020-11-27 09:37

We use the code below to inject Spring beans with properties from a properties file.



        
15条回答
  •  时光取名叫无心
    2020-11-27 09:48

    How about PropertiesLoaderUtils?

    Resource resource = new ClassPathResource("/my.properties");
    Properties props = PropertiesLoaderUtils.loadProperties(resource);
    

提交回复
热议问题