Skip to content

Instantly share code, notes, and snippets.

@punya
Created April 20, 2016 13:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save punya/e232aa0c765cf13e95bd481a8960f38b to your computer and use it in GitHub Desktop.
Save punya/e232aa0c765cf13e95bd481a8960f38b to your computer and use it in GitHub Desktop.
Using immutables for Dropwizard configuration
public class Example implements Application<ExampleConfigWrapper> {
public static void main(String[] args) throws Exception {
new Example().run(args);
}
@Override public void run(Configuration conf, Environment env) {
// do stuff
}
}
class ExampleConfigWrapper extends Configuration {
@JsonUnwrapped public ExampleConfig config;
}
@Immutable
@JsonDeserialize(as = ImmutableExampleConfig.class)
interface ExampleConfig {
int foo();
String bar();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment