我认为 spring-boot-starter-security 中的某些模块与 log4j 冲突,但我不知道是哪个。
我的gradle依赖如下:
compile("org.springframework.boot:spring-boot-starter-thymeleaf")
compile("org.springframework.boot:spring-boot-starter-security"){
exclude module: "spring-boot-starter-logging"
}
compile "org.apache.logging.log4j:log4j-api"
compile "org.apache.logging.log4j:log4j-core"
compile "org.apache.logging.log4j:log4j-slf4j-impl"
compile('org.apache.poi:poi:3.10.1')
compile('org.apache.poi:poi-ooxml:3.10.1')
testCompile("junit:junit")
最佳答案
maven 的相同解决方案:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
<version>1.5.1.RELEASE</version>
<exclusions>
<exclusion>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
</exclusion>
</exclusions>
</dependency>
关于java - LoggerFactory 不是 Logback LoggerContext 但 Logback 在类路径上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30792268/