Created
November 28, 2016 20:03
-
-
Save tavlima/c251183a34251bc4eba34034964fb142 to your computer and use it in GitHub Desktop.
Spring Boot Cloud Config (Zookeeper)
This file contains 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
@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