How to do it...

  1. First, we will comment out the content of the spring.factories file located in db-count-starter/src/main/resources in the root of our project, as follows:
#org.springframework.boot.autoconfigure.EnableAutoConfiguration=
#com.example.bookpubstarter.dbcount.DbCountAutoConfiguration
  1. Next, we will need to create the meta-annotation. We will create a new file named EnableDbCounting.java in the db-count-starter/src/main/java/com/example/bookpubstarter/dbcount directory in the root of our project with the following content:
@Target(ElementType.TYPE) 
@Retention(RetentionPolicy.RUNTIME) 
@Import(DbCountAutoConfiguration.class) 
@Documented 
public @interface EnableDbCounting { 
} 
  1. We will now add the @EnableDbCounting annotation to our BookPubApplication class and also remove the dbCountRunner(...) method from it, as shown in the following snippet:
@SpringBootApplication 
@EnableScheduling 
@EnableDbCounting 
public class BookPubApplication { 
 
  public static void main(String[] args) { 
    SpringApplication.run(BookPubApplication.class, args); 
  } 
 
  @Bean 
  public StartupRunner schedulerRunner() { 
    return new StartupRunner(); 
  } 
} 
  1. Start the application by running ./gradlew clean bootRun.
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.117.107.90