Code

Read Configuration From ClassPath – JAVA

import java.io.InputStreamReader;
import java.util.Map;
import java.util.TreeMap;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.junit.Test;
/**

  * @author David King<br />
  */
public class TransformerTest {
private Logger log = Logger.getLogger(TransformerTest.class.getName());
@Test
public void testReadConfigFileFromClasspath() {
 String mappingStream = "com/davidking/transform/user.json";
 InputStreamReader reader
 = new InputStreamReader(this.getClass().getClassLoader().getResourceAsStream(mappingStream));
log.log(Level.INFO, "Transformer mapping is: {0}", reader);
}
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s