Win a copy of React Cookbook: Recipes for Mastering the React Framework this week in the HTML Pages with CSS and JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • Himai Minh

Service required a bean of type that could not be found

 
Ranch Hand
Posts: 86
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm working on a spring boot project (following this tutorial). Consequently, I'm relying on the Apache Derby database to store my data.
When I tried running my spring boot application, I got this error:

***************************
APPLICATION FAILED TO START
***************************

Description:

Field TR in sam.springboot.service.TopicService required a bean of type 'sam.springboot.dao.TopicRepo' 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 'sam.springboot.dao.TopicRepo' in your configuration.



Here is my code:

CourseAPIdatabaseApp.java


TopicRepo.java


TopicService.java


TopicController.java


application.properties


pom.xml


What am I missing?

EDIT: here is my project structure by the way:
SpringProjectStructure01.PNG
[Thumbnail for SpringProjectStructure01.PNG]
 
Rancher
Posts: 541
6
IntelliJ IDE Spring Fedora
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You should run with debug logs.  You will be able to see if its being made and any errors.
 
Bartender
Posts: 2113
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sam,
Can you try to annotate @EnableJpaRespositories(basePackages="sam.springboot.dao") in the CourseAPIdatabaseApp ?
This way, the repository can be enabled.
 
Himai Minh
Bartender
Posts: 2113
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sam,
I have a second suggestion. Can you try to rebuild your project? How about right click on the project, select "Maven run..." and put "clean install" in the "Goal" ?
The reason why I am asking because I guess the spring boot data jpa is not on the classpath yet.
 
Himai Minh
Bartender
Posts: 2113
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sam,
One more thing you can try is to remove @Repository from the TopicRepo interface.
 
Himai Minh
Bartender
Posts: 2113
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Sam,
One more try is to use embedded h2 database instead of Derby. And also comment out each line of application.properties by adding # in front of each key/value pair.
Run the application and visit localhost:8080/topics

The pom.xml becomes like this:


Give a try to see if it works.
 
The happiness of your life depends upon the quality of your thoughts -Marcus Aurelius ... think about this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic