spring问题汇总

摘要: spring问题汇总


使用@Transactional报错

模块增加

1
requires spring.aop;

问题2 LoggerFactory is not a Logback LoggerContext

LoggerFactory is not a Logback LoggerContext but Logback is on the classpath. Either remove Logback or the competing implementation (class org.slf4j.helpers.NOPLoggerFactory loaded from file:/slf4j-api-1.7.36.jar).

增加依赖即可

Spring Boot 3 默认使用 SLF4J 2.0.x,但某些依赖可能间接引入了旧版本的 slf4j-api(如 1.7.x),导致类加载冲突。

1
2
3
4
5
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>2.0.17</version>
</dependency>