报错完整信息如下:
Exception in thread "main" java.lang.IllegalArgumentException: LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.apache.logging.slf4j.Log4jLoggerFactory loaded from file:/Users/****/.m2/repository/org/apache/logging/log4j/log4j-slf4j-impl/2.15.0/log4j-slf4j-impl-2.15.0.jar). If you are using WebLogic you will need to add 'org.slf4j' to prefer-application-packages in WEB-INF/weblogic.xml: org.apache.logging.slf4j.Log4jLoggerFactory
这种提示就是报的冲突,建议直接用maven依赖视图,搜索报错信息中提示的jar,例如我这个就是log4j-slf4j-impl,
去每一个pom中找到引用这个jar的包,然后exclusion这个包,最后只留一个即可。