I ask you for help. I have a file with properties:
[dbname1]
host= ...
port= ...
username= ...
password= ...
[dbname2]
…
[dbname3]
…
[.......]
There are more than 1 number of sections. Name of DB may be any.
Can you tell me please what is better way to read properties from file with sections: to realize it with PropertySourcesPlaceholderConfigurer or any other standart way of Spring Boot?
Thank you!
You can't have sections in a properties file
https://docs.oracle.com/cd/E23095_01/Platform.93/ATGProgGuide/html/s0204propertiesfileformat01.html
You can use YAMLformat instead ( it's supported by spring boot )
https://www.baeldung.com/spring-yaml
YAML Format supports hierarchical properties definition and you can have override them per Profile in the same file
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.