The SLF4J warning “Class path contains multiple SLF4J bindings” appears in the run log, for example after referencing sdk.renfei.net in SpringBoot. Actually this is a Jar package conflict; you just need to exclude the conflicting Jar package.
The error message is as follows:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/Users/neil/.m2/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:/Users/neil/.m2/repository/org/slf4j/slf4j-log4j12/1.7.30/slf4j-log4j12-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]

Cause Analysis
The error message means the logback-classic package and the slf4j-log4j12 package conflict over the class org/slf4j/impl/StaticLoggerBinder.class. The cause: reportedly the logback logging developers and the log4j developers are the same group of people, and the new version of SpringBoot defaults to the logback logging plugin, while many third-party tools include log4j. For example, sdk.renfei.net uses the log4j logging plugin, so basically any SpringBoot project will, if not careful, surely hit this conflict.
The Hidden Risk
Although it may not affect project startup, after packaging into a Jar, it may fail to start online. So we should resolve this problem to avoid the hidden risk of startup failure.
Solution
The solution is simple: just exclude the conflicting Jar package. If you use logback logging, you must exclude the slf4j-log4j12 package, not the logback-classic package. Since I decided to mainly use logback, I exclude the log4j slf4j-log4j12 package — find out who depends on slf4j-log4j12, then exclude it by adding exclusions in the dependency node of the pom file that references it:
<dependency>
<groupId>net.renfei</groupId>
<artifactId>sdk</artifactId>
<version>${renfeisdk.version}</version>
<exclusions>
<!-- Exclude slf4j-log4j12 -->
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
</exclusion>
</exclusions>
</dependency>
First find the Maven management menu and click “Show Dependencies”

Then you get a dependency graph; we find the conflicting package to know who introduced it, and then exclude it.


