Skip to content

Instantly share code, notes, and snippets.

@tavlima
Created November 28, 2016 20:03
Show Gist options
  • Save tavlima/c251183a34251bc4eba34034964fb142 to your computer and use it in GitHub Desktop.
Save tavlima/c251183a34251bc4eba34034964fb142 to your computer and use it in GitHub Desktop.
Spring Boot Cloud Config (Zookeeper)
@SpringBootApplication
public class CloudExperimentApplication implements CommandLineRunner {
private final Logger logger = LoggerFactory.getLogger(getClass());
@Autowired
private Environment environment;
public static void main(String[] args) {
SpringApplication.run(CloudExperimentApplication.class, args);
}
@Override
public void run(String... args) throws Exception {
// APPNAME -> spring.application.name (boostrap.properties > application.properties)
// PROFILE -> --spring.profiles.active=dev
// APP_ENV -> APPNAME + [,PROFILE] ("myapp,dev", for instance, if "dev" is the profile)
// "sample" -> /config/APP_ENV/sample
logger.info(environment.getProperty("sample"));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment