Enabletransactionmanagement Cannot Be Resolved to a Type

Enabletransactionmanagement Cannot Be Resolved to a Type
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...

}

i have a problem with @EnableTransactionManagement the following error that occurs is:EnableTransactionManagement cannot be resolved to a type.

i have the following dependency in my pom.xml:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-tx</artifactId>
    <version>4.1.6.RELEASE</version>
</dependency>

i have also tried using the following import:

import org.springframework.transaction.annotation.EnableTransactionManagement;

this gave me the following error:

The import org.springframework.transaction.annotation.EnableTransactionManagement cannot be resolved
9

3 Answers

You are missing the spring-orm dependency for Object Relational Mapping.

Just import it into your pom file

<dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-orm</artifactId>
        <version>4.1.6.RELEASE</version>
</dependency>

I had to just re add the jar file to the libraries in my project and the class was there. thanks for help meriton

If you develop in the IntelliJ, right click in the POM file and add as a Maven project. It should solve the issue.

Before

After

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Sophia Al-Mansoor
Author

Sophia Al-Mansoor

Sophia analyzes international trade, startup ecosystems, retail transformation, and supply chain logistics for modern digital publications.