|
|
@@ -55,7 +55,7 @@ public class Prop {
|
|
|
public Prop(String fileName, String encoding) {
|
|
|
InputStream inputStream = null;
|
|
|
try {
|
|
|
- inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(fileName); // properties.load(Prop.class.getResourceAsStream(fileName));
|
|
|
+ inputStream = getClassLoader().getResourceAsStream(fileName); // properties.load(Prop.class.getResourceAsStream(fileName));
|
|
|
if (inputStream == null) {
|
|
|
throw new IllegalArgumentException("Properties file not found in classpath: " + fileName);
|
|
|
}
|
|
|
@@ -69,6 +69,11 @@ public class Prop {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private ClassLoader getClassLoader() {
|
|
|
+ ClassLoader ret = Thread.currentThread().getContextClassLoader();
|
|
|
+ return ret != null ? ret : getClass().getClassLoader();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* Prop constructor.
|
|
|
* @see #Prop(File, String)
|