While working with dropwizard,
My dropwizard service reads the config.yml file.
public void run() throws Exception {
this.run(new String[] { "server", "src/main/resources/config.yml" });
}
Config.yml file :
database:
# the name of your JDBC driver
driverClass: com.mysql.jdbc.Driver
# the username
user: user2connect
# the password
password: password2connect
# the JDBC URL
url: jdbc:mysql://url.to.connect:port
But, I am getting an error as soon as the file is read -
Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "database" (class com.service.config.DropWizardConfiguration), not marked as ignorable (4 known properties: , "http", "httpConfiguration", "logging", "loggingConfiguration"])
at [Source: N/A; line: -1, column: -1] (through reference chain: com.service.config.DropWizardConfiguration["database"])
After going through few topics, I realized that this might be causing because of Jackson is not able to ignore few properties.
I tried couple of things -
1) Added annotation @JsonIgnoreProperty (But not sure if I added it at expected place)
2) Jackson how to ignore properties
None of them helped. Can anyone point me what I might be missing here?