java

关注公众号 jb51net

关闭
首页 > 软件编程 > java > springboot启动时报错ApplicationEventMulticaster not initialized

解决springboot启动时报错的问题ApplicationEventMulticaster not initialized

作者:何以清风

这篇文章主要介绍了解决springboot启动时报错的问题ApplicationEventMulticaster not initialized,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教

问题复现

今天遇到这个问题,出现的次数并不多并且之前遇到过。

本人是在将项目编译上线后,在自己电脑上启动时,报了这个错误

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>

将这段代码注释掉,重新启动项目成功!

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文