SLF4J: Class path contains multiple SLF4J bindings


SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/xxx/.m2/repository/ch/qos/logback/logback-classic/1.2.5/logback-classic-1.2.5.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/Users/xxx/.m2/repository/ch/qos/logback/logback-classic/1.2.4/logback-classic-1.2.4.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]

编译项目报这个warning,意思是有多个SLF4J

 

1、mvn dependency:tree

打开终端,定位到项目所在的目录,输入命令。

 

 上面提示中“ch/qos/logback/logback-classic”,根据提示,我们找到相应的地方,排除就可以解决。

 

2. 使用<exclusions>排除引用

<dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter</artifactId>
            <version>1.2.0</version>
            <exclusions>
                <exclusion>
                    <groupId>ch.qos.logback</groupId>
                    <artifactId>logback-classic</artifactId>
                </exclusion>
            </exclusions>
        </dependency>

重新启动application,warning就消失了。

https://mybatis.org/spring-boot-starter/mybatis-spring-boot-autoconfigure/

 

 

 mybatis : http://mybatis.org/spring/zh/index.html

https://spring.io/projects/spring-boot#learn

 

分析:

其实之前的项目并没有出现过类似的情况,也不要去排除,但这次竟然报了个warning,后来发现因为之前的一些打印日志不出来了,

然后根据eclipse的提示操作,然后就误把另一个项目引入到了Java Build Path中,导致出现了冲突报错,直接删除,问题解决。

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM