看的别人的源代码是这样:
import org.springframework.transaction.annotation.Transactional;
但其实对我来说是错误的
应该是:
import org.springframework.transaction.annotation.Transactional;
添加的依赖如下:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>5.0.8.RELEASE</version>
</dependency>
最后,今天的一大收获是知道了
https://mvnrepository.com
可以查所需要的东西,直接复制粘贴dependency。有些类不在我们所以为的包里,这个网站就显得很有用。