spring-boot-starter-websocket logging衝突問題

原項目可正常啓動

引入如下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>

這樣可以解決問題,但我指出來的依賴關係好像並不正確,如果有大神路過麻煩指正一下相關引用關係

發佈了20 篇原創文章 · 獲贊 0 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章