SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/apache-maven-3.6.3/localRepository/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:/apache-maven-3.6.3/localRepository/org/slf4j/slf4j-log4j12/1.7.25/slf4j-log4j12-1.7.25.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
這是因為與logback的沖突並未解決,導致啟動失敗,根據上面的報錯信息,找到logback-classic-1.2.3.jar和slf4j-log4j12-1.7.25.jar的相應位置刪除,並在pom.xml中加入如下排除代碼:
<
dependency
>
<
groupId
>
org.springframework.boot
</
groupId
>
<
artifactId
>
spring-boot-starter-web
</
artifactId
>
<!--
排除默認的
logback
日志,使用
log4j-->
<
exclusions
>
<
exclusion
>
<
groupId
>
org.springframework.boot
</
groupId
>
<
artifactId
>
spring-boot-starter-logging
</
artifactId
>
</
exclusion
>
<!--<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>-->
<
exclusion
>
<
groupId
>
ch.qos.logback
</
groupId
>
<
artifactId
>
logback-classic
</
artifactId
>
</
exclusion
>
</
exclusions
>
</
dependency
>
注釋兩者其中的一個就行