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.

Update: Solution

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.

Answers


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 );

Need Your Help

Django: Switching to Jinja2?

django django-templates jinja2

I've got a couple small (500 or 600 lines of template code) Django sites, and I'd like to migrate them to using Jinja2… But I'd like to get some idea of how much work it will be. So, in general, ab...

JavaScript charAt() doesn't like user input that isn't zero

javascript html

this may be a stupid question or a typo but I'm going to ask anyway... I have the following form and when the form is submitted I want to check all the values of the input type="number" and make sure

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.