Does Spring put all properties into the same hashmap/list?
How can I get a list of all of the properties being managed by Spring
For example, if I have two properties files and they define overlapping properties which
// FILE: src/main/resources/file1.properties
prop1.color = red
prop1.fill = green
// FILE: src/main/resources/file2.properties
prop2.color = purple
prop1.fill = ORANGE
The configuration class used to tell Spring to read the two files is something like this:
@PropertySource("classpath:file1.properties")
@PropertySource("classpath:file2.properties")
@Configuration
public class MyConfig {
}
My question is Can I get an iterator to access all of the properties defined? If so how.
Searching for answer
So far I haven't found a solution to this question.
I did an Internet search for "stack overflow Spring properties" and did not found the answer.
Some SO questions I found are:
- Spring boot get all properties from properties file and load into hashmap
- Spring Boot application.properties
But they didn't answer my question