

Im trying to only do a getmapping for this application and when I go to autowire in the dogservices it says no beans of dog service found. I implement the method header in dogservices and used it dogServicesImpl - Code in pics! Thanks in advance!


Im trying to only do a getmapping for this application and when I go to autowire in the dogservices it says no beans of dog service found. I implement the method header in dogservices and used it dogServicesImpl - Code in pics! Thanks in advance!
Your DogServiceImpl is not decorated with any of the annotations that Spring will use to treat the class as a bean.
Spring will scan everything in your project at its startup, and find classes that are decorated with annotations such as @Component, @Controller and so on. When it finds them, it will handle them in its IoC container, and it will be possible to request an injection with @Autowired.
Your DogServiceImpl is not decorated. It should be annotated with @Service, that is the annotation Spring suggests to use in this case.
Also, you're decorating your controller with @RestController and @Component, but @RestController is an extension of @Controller, that is an extension of @Component, so you only need to use @RestController in your controller.