0
I am testing my Spring application with Junit, however the error occurs after placing the annotation @EnableJpaRepositories
:
Caused by: org.springframework.Beans.factory.Nosuchbeandefinitionexception: No bean named 'entityManagerFactory' available
Configuration class:
@SpringBootApplication
@ComponentScan
@EnableJpaRepositories
public class ExampleApplication {
public static void main(String[] args) {
SpringApplication.run(ExampleApplication.class, args);
}
}
Removing this annotation returns the problem that does not find a dependency for the repository interface.
Obs: The application starts normally, this problem occurs when running the tests, with both Gradle and Junit.