Springboot 启动时,让方法自动执行的5种方法

Springboot 启动时,让方法自动执行的5种方法

前提 类上@Component

1.实现ServletContextAware
2.实现ServletContextListener
3.实现ApplicationRunner
4.static 静态代码块
5.方法上加@PostConstruct

猜你喜欢

转载自blog.csdn.net/hsadfdsahfdsgfds/article/details/115366760
今日推荐