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万+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章