// application.properties logging.level.org.springframework=debug spring.profiles.active=dev // Now application-dev.properties will be loaded currency-service.url=http://default1.com currency-service.username=defaultusername currency-service.key=defaultkey management.endpoints.web.exposure.include=* // enables actuator // application-dev.properties logging.level.org.springframework=trace currency-service.url=http://dev.com currency-service.username=devusername currency-service.key=devkey //application-prod.properties logging.level.org.springframework=info @ConfigurationProperties(prefix = "currency-service") // Overrides property configuration of anything starting with currency-service @Component public class CurrencyServiceConfiguration { private String url; //currency-service.url= private String username; //currency-service.username= private String key; //currency-service.key= // getters and setters } @RestController public class CurrencyConfigurationController { // returns the property values that maps to the given component as json @Autowired private CurrencyServiceConfiguration configuration; @RequestMapping("/currency-configuration") public CurrencyServiceConfiguration retrieveAllCourses() { return configuration; } } // Alternative approach: provide configuration class where main method resides with @EnableConfigurationProperties annotation @SpringBootApplication @EnableConfigurationProperties(ConfigProperties.class) public class EnableConfigurationDemoApplication { public static void main(String[] args) { SpringApplication.run(EnableConfigurationDemoApplication.class, args); } }