0

Is there a way to list all of the parameters that exist in an application.yml properties file?

If I have these properties, can I list them similar to the display below?

application.yml

parentProp1:
  childProp1: childProp1Value1
  childProp2: childProp1Value2
  childProp3: childProp1Value3

parentProp2:
  childProp1: childProp1Value1
  childProp2: childProp1Value2
  childProp3: childProp1Value3

Display like this:

parentProp1:childProp1:childProp1Value1
parentProp1:childProp2:childProp1Value2
parentProp1:childProp3:childProp1Value3

parentProp2:childProp1:childProp1Value1
parentProp2:childProp2:childProp1Value2
parentProp2:childProp3:childProp1Value3

Note: I can access the properties using @Value or environment.GetProperty, that part works fine, but is there a way, in Java, to iterate over all of the porperties in the application.yml file?

vscoder
  • 929
  • 1
  • 10
  • 25
  • You could autowire `Environment` and then iterate over them all. – 123 Mar 24 '20 at 17:28
  • Yes, but what is the command to iterate over all the properties in the application.yml file without knowing the names of those parms? – vscoder Mar 24 '20 at 17:31
  • Yes, that appears to provide the information I want, thanks for finding that link. – vscoder Mar 24 '20 at 18:02

0 Answers0