Created
April 20, 2016 13:06
-
-
Save punya/e232aa0c765cf13e95bd481a8960f38b to your computer and use it in GitHub Desktop.
Using immutables for Dropwizard configuration
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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