Quick View all springboot project from the start execution method

For RestController can access the address, starting to call, but since the start of class methods, when local debugging, sometimes trouble, output piles of logs, modify data, etc.

The following is a summary of common since the launch of the project springboot

  • @Scheduled (fixedRate = 5 * 60 * 100) very short timing cron
  • @Scheduled(fixedRate = 30 * 60 * 1000)
  • Inherit the run method of class CommandLineRunner or ApplicationRunner
  • @EventListener annotated method parameter is ApplicationReadyEvent
  • After the initialization operation performed @PostConstruct class, but can not guarantee that the container has been completely initialized spring, the ApplicationContextAware value can not be guaranteed to take, or preferably with ApplicationRunner @EventListener
  • while (true) empty constructor in the continued implementation of

Guess you like

Origin blog.csdn.net/c5113620/article/details/91812556