- We will start by adding an @Profile annotation to the @Bean creation of schedulerRunner by changing the definition of the schedulerRunner(...) method in BookPubApplication.java, located in the src/main/java/org/test/bookpub directory at the root of our project, to the following content:
@Bean
@Profile("logger")
public StartupRunner schedulerRunner() {
return new StartupRunner();
}
- Start the application by running ./gradlew clean bootRun.
- Once the application is running, we should no longer see the previous log output from the StartupRunner class, which looked like this:
2017-12-17 --- org.test.bookpub.StartupRunner : Number of books: 1
- Now, let's build the application by running ./gradlew clean bootJar and start it by ...