Springboot 启动时,让方法自动执行的5种方法 前提 类上@Component 1.实现ServletContextAware 2.实现ServletContextListener 3.实现ApplicationRunner 4.static 静态代码块 5.方法上加@PostConstruct