CAS5 依赖Spring data jpa 后日志冲突

报错

说明 log4j-slf4j-impl-2.9.1.jar 和 slf4j-log4j12-1.7.2.jar 冲突了

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ms-notify/WEB-INF/lib/log4j-slf4j-impl-2.9.1.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/E:/workspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp0/wtpwebapps/ms-notify/WEB-INF/lib/slf4j-log4j12-1.7.2.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 [org.apache.logging.slf4j.Log4jLoggerFactory]

修改pom文件

<dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-data-jpa</artifactId>
     <version>1.5.12.RELEASE</version>
    <exclusions>
        <exclusion>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
        </exclusion>
    </exclusions>
</dependency>

**注意**jpa版本最好1.5;因为2.0以上会引入log4j-to-slf4j.jar包引发log溢出
修改pom文件后请清除缓存,最好手动查看生成的lib下的jar包,对比修改前后是否还有冲突的包。

猜你喜欢

转载自blog.csdn.net/qq_17348297/article/details/80802412