Issue
I tried to Create Interface by extending the CRUD Repository with annotation @Repository. Also I tried to use the interface function in Service class using Auto wired annotation. But I am facing the issue given below
***************************
APPLICATION FAILED TO START
***************************
Description:
Field bookRepository in com.example.service.BookService required a bean of type 'com.example.repo.BookRepository' that could not be found.
The injection point has the following annotations:
- @org.springframework.beans.factory.annotation.Autowired(required=true)
Action:
Consider defining a bean of type 'com.example.repo.BookRepository' in your configuration.
Project Structure are given below:
Solution
The problem is with your project structure. Try replacing all other packages under:
com.example.learn
package
Folowing above you won't need @ComponentScan and @Repository as @SpringBootApplication will take care of it.
Answered By - aang13