I get error when I run the main class.
Error:
Action:
Consider defining a bean of type \'seconds47.service.TopicService\' in your c
Even after doing all the method suggested, i was getting the same error. After trying hard, i got to know that hibernate's maven dependency was added in my pom.xml, as i removed it, application started successfully.
I removed this dependency:
<dependency> <groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
</dependency>
I solved this issue by creating a bean for my service in SpringConfig.java file. Please check the below code,
@Configuration
public class SpringConfig {
@Bean
public TransactionService transactionService() {
return new TransactionServiceImpl();
}
}
The path of this file is shown in the below image, Spring boot application folder structure
I resolved by replacing the corrupted jar files.
But to find those corrupted jar files, I have to run my application in three IDE- 1) Intellij Idea 2)NetBeans 3) Eclipse.
Netbeans given me information for maximum number of corrupted jar. In Netbeans along with the run, I use the build option(after right clicking on project) to know more about corrupted jars.
It took me more than 15 hours to find out the root cause for these errors. Hope it help anyone.
Consider defining a bean of type 'moviecruser.repository.MovieRepository' in your configuration.
This type of issue will generate if you did not add correct dependency. Its the same issue I faced but after I found my JPA dependency is not working correctly, so make sure that first dependency is correct or not.
For example:-
The dependency I used:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-jpa</artifactId>
</dependency>
Description (got this exception):-
Parameter 0 of constructor in moviecruser.serviceImple.MovieServiceImpl required a bean of type 'moviecruser.repository.MovieRepository' that could not be found.
Action:
After change dependency:-
<!--
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
Response:-
2019-09-06 23:08:23.202 INFO 7780 -
[main]moviecruser.MovieCruserApplication]:Started MovieCruserApplication in 10.585 seconds (JVM running for 11.357)
Please make sure that you have added the dependency in pom.xml or gradle file
spring-boot-starter-data-jpa
You have to update your
scanBasePackages = { "com.exm.java" }
to add the path to your service (after annotating it with @service )