原項目可正常啓動
引入如下jar包後啓動失敗
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
</dependency>
原因是spring-boot-starter-websocket包中含有spring-boot-starter-logging
spring-boot-starter-websocket----->spring-boot-start----->spring-boot-starter-logging
且項目中也含有
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>
所以排除其中一個log相關jar就可以了,如下
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-websocket</artifactId>
<exclusions>
<exclusion>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
這樣可以解決問題,但我指出來的依賴關係好像並不正確,如果有大神路過麻煩指正一下相關引用關係