2

I'm loading multiple properties files in a sort of cascading hierarchy, and I would like to be able to list out each of the files that are detected. I'm wondering how to get any properties files that are detected as things start up so that I can log them to the console.

The properties files are being defined in an application context xml but since some of them are optional, I don't "really" know what's being loaded until runtime.

Here's an example entry:

<beans>

    <context:property-placeholder location="classpath:common.properties" ignore-unresolvable="true" ignore-resource-not-found="true" order="99"/>

</beans>

I do have some code that executes on startup, so I just am looking for the best way to get a list of the files that were detected and log them out. Preferably without having to modify the way they are loaded in the first place.

RutledgePaulV
  • 2,568
  • 3
  • 24
  • 47
  • Check http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/beans/factory/config/PropertyPlaceholderConfigurer.html - perhaps you will find the answer there. – Michal Wilkowski Jan 22 '15 at 23:28
  • I would prefer to just get a list of the loaded files without needing to define my own subclass of the `PropertyPlaceholderConfigurer` and track them as I load them. But, I am aware of that as a potential approach. Thanks! – RutledgePaulV Jan 22 '15 at 23:31
  • 1
    Perhaps [this](http://stackoverflow.com/questions/14303381/how-to-log-properties-loaded-by-spring) will help. – Rohit Jan 23 '15 at 06:05

0 Answers0