解决Slf4J报错:Class path contains multiple SLF4J bindings

在运行maven项目的时候由于依赖冲突出现如下问题:

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/maven_repository/ch/qos/logback/logback-classic/1.2.3/logback-classic-1.2.3.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/maven_repository/org/slf4j/slf4j-simple/1.7.30/slf4j-simple-1.7.30.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]

项目中依赖了多个不同版本的slf4j类库,我们可以使用dependency:tree命令:

$ mvn dependency:tree

解决Slf4J报错:Class path contains multiple SLF4J bindings_第1张图片

找到冲突的依赖,向上找到引入依赖的根源,在对应的pom文件里,添加 标签即可


    com.baidu.aip
    java-sdk
    4.15.3
    
        
            org.slf4j
            slf4j-simple
        
    

最后重启

你可能感兴趣的:(java,数据库,开发语言)