Last active
March 27, 2018 12:05
-
-
Save aarshtalati/ae386471c78e815d4fed3b801557923c to your computer and use it in GitHub Desktop.
Read configurations from application.properties file
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
package edu.gatech.epidemics; | |
import org.springframework.beans.factory.annotation.Value; | |
import org.springframework.boot.context.properties.ConfigurationProperties; | |
import org.springframework.context.annotation.PropertySource; | |
import org.springframework.stereotype.Component; | |
/** | |
* @author atalati | |
*/ | |
@Component | |
@PropertySource("application-${spring.profiles.active}.properties") | |
@ConfigurationProperties | |
public class AppConfigBean { | |
@Value("${db_driver}") | |
private String db_driver; | |
@Value("${db_url}") | |
private String db_url; | |
@Value("${db_username}") | |
private String db_username; | |
@Value("${db_password}") | |
private String db_password; | |
@Value("${db_platform}") | |
private String db_platform; | |
// getters and setters ... | |
// toString() override | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment