/**
* Loads props from classpath.
*/
public static void loadFromClasspath(final Props p, final String... patterns) {
final ClassScanner scanner = new ClassScanner() {
@Override
protected void onEntry(EntryData entryData) throws IOException {
String encoding = JoddCore.encoding;
if (StringUtil.endsWithIgnoreCase(entryData.getName(), ".properties")) {
encoding = StringPool.ISO_8859_1;
}
p.load(entryData.openInputStream(), encoding);
}
};
scanner.setIncludeResources(true);
scanner.setIgnoreException(true);
scanner.setExcludeAllEntries(true);
scanner.setIncludedEntries(patterns);
scanner.scanDefaultClasspath();
}