一、确定类从哪个jar包加载的
Class clazz = Node.DynamicTestExecutor.class;
String jarPath = clazz.getProtectionDomain().getCodeSource().getLocation().getPath();
System.out.println("jarPath: " + jarPath);
二、在lib或者pom.xml中排除掉冲突的jar即可
比如通过exclusion排除掉:log4j-to-slf4j
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-to-slf4j</artifactId>
</exclusion>
</exclusions>
</dependency>