简体   繁体   中英

Spring Boot load properties as java.util.Properties

In Spring Boot it is pretty straightforward to read properties from the application.properties (@Value), but what I would like to do is to load all properties in a java.util.Properties object.

Is this possible?

I think it's possible. You can see how it can be done from here(Click). . And Before doing it, please consider:

  1. Where to put property file?(Same directory as Springboot property file exists?)
  2. For what purpose do you need to use "Property" over "@Value"?
  3. Will other people can read easily with code used "Property"?

Please consider to use "Spring cloud conf" if this seems to be useful for you.

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM