Search code examples
javajakarta-eepropertiesclasspathclassloader

Is it possible load all properties files contained in a package dynamically? i.e. MyClass.class.getResource('*.properties');


I am familiar with obtaining the contents of a properties file given the name of the file, and obviously MyClass.class.getResource('*.properties') will not work, but how can I obtain a list of ALL the properties files located in the same package as my class?


Solution

  • You can do these sort of things with Spring. See 4. Resources, particurlarely (or notabily ? ) (or principalementely ? ) (or mainly ? ) at 4.7.2 Wildcards in application context constructor resource paths.