I need to inject a java.utils.Properties
instance into one of my beans. Is there a Spring class which will load the properties file and convert it into a java.utils.Properties
instance, ready for injection?
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"/>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.