Q:

DropWizard can't find field database (v 1.0.5)

My configuration isn't found by DropWizard, don't get it.
AppConfiguration class:
package se.test.app;

import com.fasterxml.jackson.annotation.JsonProperty;
import io.dropwizard.Configuration;
import io.dropwizard.db.DataSourceFactory;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;

public class AppConfiguration extends Configuration {
    @Valid
    @NotNull
    private DataSourceFactory database = new DataSourceFactory();

    @JsonProperty("database")
    public DataSourceFactory getDataSourceFactory() {
        return database;
    }
}

And in app.yaml
database:
  driverClass: com.mysql.jdbc.Driver
  user: db_user
  password: db_password
  url: jdbc:mysql://localhost/my_db

  properties:
    charSet: UTF-8
    hibernate.dialect: org.hibernate.dialect.MySQLDialect

But in terminal when running:
  * Unrecognized field at: database
    Did you mean?:
      - metrics
      - server
      - logging

A:

Include dropwizard-jdbi in your pom.xml.
<dependency>
    <groupId>io.dropwizard</groupId>
    <artifactId>dropwizard-jdbi</artifactId>
    <version>1.0.5</version>
</dependency>

See the documentation of Dropwizard JDBI.

