我认为spring引导启动安全性中的某些模块与log4j冲突,但我不知道是哪个模块。
我对等级的依赖如下:
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")发布于 2015-06-12 14:39:41
我想出来了
compile("org.springframework.boot:spring-boot-starter-security"){
exclude module: "spring-boot-starter-logging"
exclude module: "logback-classic"
}
compile("org.springframework.boot:spring-boot-starter-thymeleaf"){
exclude module: "logback-classic"
}发布于 2017-03-07 06:15:28
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>发布于 2020-01-30 12:18:58
问题继续下去:要么删除Logback,要么删除从log4j-slf4j-impl-2.12.0.jar加载的竞争性实现类org.apache.logging.slf4j.Log4jLoggerFactory。
我加了
configurations {
all {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
exclude group: 'ch.qos.logback', module: 'logback-classic'
exclude group: 'org.apache.logging.log4j', module: 'log4j-to-slf4j'
}
}也刷新了所有项目依赖关系的最新版本,并解决了问题。
https://stackoverflow.com/questions/30792268
复制相似问题