Upload properties file to java.util.Properties file?

I need to inject an instance of java.utils.Properties into one of my beans. Is there a Spring class that will load the properties file and convert it to an java.utils.Properties instance, ready for injection?

+4
source share
1 answer

Yes, using <util:properties> (see documentation ).

Example:

 <!-- creates a java.util.Properties instance with values loaded from the supplied location --> <util:properties id="jdbcConfiguration" location="classpath:com/foo/jdbc-production.properties"/> 
+11
source

Source: https://habr.com/ru/post/1389371/


All Articles