报错java.lang.IllegalStateException: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@429f7919 has been closed already
原因:
1、ApplicationContext has been closed already 上下文已经关闭,但是还有线程在 getBean(); 是在停止应用时发生的,主线程已经停止,springboot上下文关闭,子线程刚好还在执行。一般在优雅停止会出现,并非代码问题
2、项目启动报错,应用停止,子线程抛出此异常。解决启动报错问题即可