Push the boundaries of Dropwizard.
The fix for Issue #1314 should load classes on the classpath.
test/resources/example.txt
whee
@Test
public void readsFileContents() throws Exception {
try (InputStream input = provider.open("example.txt")) {
assertThat(new String(ByteStreams.toByteArray(input), StandardCharsets.UTF_8).trim()).isEqualTo("whee");
}
}
public class ResourceConfigurationSourceProvider implements ConfigurationSourceProvider {
@Override
public InputStream open(String path) throws IOException {
return getClass().getClassLoader().getResourceAsStream(path);
}
}