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>

將這段代碼註釋掉,重新啓動項目成功!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章