springboot启动时报错的问题 - ApplicationEventMulticaster not initialized
springboot启动时报错的问题-ApplicationEventMulticaster not initialized - call 'refresh' before multicas
大家好
最近,本人一直在开发项目。一直没有更新博客。
今天遇到这个问题,出现的次数并不多并且之前遇到过。
问题复现
本人是在将项目编译上线后,在自己电脑上启动时,报了这个错误ApplicationEventMulticaster not initialized - call ‘refresh’ before multicas。
我看了一下网上的解决方案,并未解决我的问题。刚我回顾了一下我的部署修改内容给的时候。
突然想到了为了将项目打包到tomcat上,在pom.xml中加入了如下这段配置。
大家应该知道springboot项目是热启动的内置tomcat项目,如果需要部署tomcat上,需要将其打包成war包,并且添加如下配置。
<!-- 设置内置的tomcat容器与外部容器不冲突 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
<version>${spring-boot.version}</version>
<scope>provided</scope>
</dependency>
将这段代码注释掉,重新启动项目成功!