com.tngtech.propertyloader.impl.openers.ContextClassLoaderOpener Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of property-loader Show documentation
Show all versions of property-loader Show documentation
The property loader is a java library for managing property configurations.
package com.tngtech.propertyloader.impl.openers;
import com.tngtech.propertyloader.impl.interfaces.PropertyLoaderOpener;
import java.io.InputStream;
/**
* Searches for properties files using the ContextClassLoader from the current thread.
*/
public class ContextClassLoaderOpener implements PropertyLoaderOpener {
public InputStream open(String fileName) {
ClassLoader contextClassLoader = Thread.currentThread().getContextClassLoader();
return contextClassLoader.getResourceAsStream(fileName);
}
@Override
public String toString() {
return "in classpath";
}
}