Created
November 6, 2015 12:58
-
-
Save javaeeeee/53f0f523647bb539b417 to your computer and use it in GitHub Desktop.
Changes to Configuration class to enable database connection in a Dropwizard project
This file contains hidden or 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 DWGettingStartedConfiguration extends Configuration { | |
| ... | |
| /** | |
| * A factory used to connect to a relational database management system. | |
| * Factories are used by Dropwizard to group together related configuration | |
| * parameters such as database connection driver, URI, password etc. | |
| */ | |
| @NotNull | |
| @Valid | |
| private DataSourceFactory dataSourceFactory | |
| = new DataSourceFactory(); | |
| ... | |
| /** | |
| * A getter for the database factory. | |
| * | |
| * @return An instance of database factory deserialized from the | |
| * configuration file passed as a command-line argument to the application. | |
| */ | |
| @JsonProperty("database") | |
| public DataSourceFactory getDataSourceFactory() { | |
| return dataSourceFactory; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment