Java EnableTransactionManagement无法解析为类型
我对@EnableTransactionManagement有问题 发生以下错误:EnableTransactionManagement无法解析为类型 我的pom.xml中有以下依赖项:Java EnableTransactionManagement无法解析为类型,java,maven,pom.xml,Java,Maven,Pom.xml,我对@EnableTransactionManagement有问题 发生以下错误:EnableTransactionManagement无法解析为类型 我的pom.xml中有以下依赖项: package com.shaun.spring.config; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration;
package com.shaun.spring.config;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@Configuration
@ComponentScan("com.shaun.spring")
@EnableTransactionManagement
public class ApplicationContextConfig {
// @Bean configurations go here...
}
这给了我以下错误:
import org.springframework.transaction.annotation.EnableTransactionManagement;
我只需将jar文件重新添加到项目中的库中,类就在那里。感谢meriton的帮助如果您在
IntelliJ
中开发,请右键单击POM
文件并添加为Maven
项目。它应该解决这个问题
以前
之后
您缺少对象关系映射的
spring orm
依赖项
只需将其导入pom文件
The import org.springframework.transaction.annotation.EnableTransactionManagement cannot be resolved
org.springframework
春季甲虫
4.1.6.1发布
您使用的是什么开发环境(eclipse、IntelliJ等)?(其maven集成可能有问题)@meriton我正在使用Eclipse。您可能想检查项目视图中的文件夹“maven Dependencies”是否确实包含spring-tx.jar,以及该文件夹是否包含EnableTransactionManagement类。@meriton我有这个jar,但似乎没有该类。根据,它应该在那里。您是否也从maven中央存储库获得了该工件?不管怎样,你的maven看起来都不正常。
The import org.springframework.transaction.annotation.EnableTransactionManagement cannot be resolved
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>4.1.6.RELEASE</version>
</dependency>