All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.tngtech.propertyloader.impl.openers.ContextClassLoaderOpener Maven / Gradle / Ivy

There is a newer version: 1.5.1
Show newest version
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";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy