Dropwizard: Multiple configurations
We are using Dropwizard (in Java) for our Rest api development. Now recently, I added few application specific configuration files.
Instead of specifying the file path in code, we added the file paths in the "cofig.yml" file that Dropwizard loads during the startup.
What would be the best way to create a Configuration class out of the "newly added" configuration files?
I was using SnakesYml to parse. But it requires me to hardcode all the "keys". Instead, I want to see if I can simply create a configuration class for a file that I add. This is similar to what Dropwizard does for "config.yml" at start up.
Nevermind. I got the solution. Used SnakesYml. That has this:
Configuration config = yaml.loadAs( in, Configuration.class );
Sorry for bothering. I love the community, so sometimes, on a friday evening, when I am stuck, I ask such questions. Apologies.
As per Jan Galinski, I am posting the answer to my question:
Solution I used SnakesYml. That has "loadAs" method :
Yaml yaml = new Yaml(); Configuration config = yaml.loadAs( in, Configuration.class );