1.實現ApplicationRunner和CommandLineRunner接口(建議)
當springboot的main方法快要執行結束時會調用afterRefresh然后再調用callRunners來加載所有的實現ApplicationRunner和CommandLineRunner的類然后執行run方法來初始化所寫的東西
2.<1>實現InitializingBean接口(不建議) <2><bean>元素中配置指定的init-method <3>@PostConstruct
3.實現ContextRefreshedEvent類型ApplicationListener接口ApplicationListener<ContextRefreshedEvent>,然后重寫onApplicationEvent方法
