- Let's start by adding a bit of code to log the value of our particular configuration property so that we can easily see the change in it as we do different things. Add an @Bean method to the BookPubApplication class located in the src/main/java/org/test/bookpub directory at the root of our project with the following content:
@Bean
public CommandLineRunner configValuePrinter( @Value("${my.config.value:}") String configValue) {
return args -> LogFactory.getLog(getClass()). info("Value of my.config.value property is: " + configValue);
}
- Let's build the application by running ./gradlew clean bootJar and start it by running ./build/libs/bookpub-0.0.1-SNAPSHOT-exec.jar --spring.profiles.active=logger so as to see the following ...