UnsatisfiedDependencyException: Error creating bean with name

后端 未结 19 849
遇见更好的自我
遇见更好的自我 2020-11-30 01:47

For several days I\'m trying to create Spring CRUD application. I\'m confused. I can\'t solve this errors.

org.springframework.beans.factory.Unsatisfi

相关标签:
19条回答
  • 2020-11-30 02:11

    Add @Repository annotation to the Spring Data JPA repo

    0 讨论(0)
  • 2020-11-30 02:11

    See if your is missing in either config or context xml file

    0 讨论(0)
  • 2020-11-30 02:12

    That might happen because the pojos you are using lack of the precise constructor the service needs. That is, try to generate all the constructors for the pojo or objects (model object) that your serviceClient uses, so that the client can be instanced correctly. In your case,regenerate the constructors (with arguments)for your client object (taht is your model object).

    0 讨论(0)
  • 2020-11-30 02:13

    I was facing the same issue, and it was, as i missed marking my DAO class with Entity annotations. I tried below and error got resolved.

    /**
    *`enter code here`
    */
    @Entity <-- was missing earlier
        public class Topic {
            @Id  
            String id;
            String name;
            String desc;
    
        .
        .
        .
        }
    
    0 讨论(0)
  • 2020-11-30 02:14

    The application needs to be placed in the same directory as the scanned package:

    enter image description here

    0 讨论(0)
  • 2020-11-30 02:16

    If you are using Spring Boot, your main app should be like this (just to make and understand things in simple way) -

    package aaa.bbb.ccc;
    @SpringBootApplication
    @ComponentScan({ "aaa.bbb.ccc.*" })
    public class Application {
    .....
    

    Make sure you have @Repository and @Service appropriately annotated.

    Make sure all your packages fall under - aaa.bbb.ccc.*

    In most cases this setup resolves these kind of trivial issues. Here is a full blown example. Hope it helps.

    0 讨论(0)
提交回复
热议问题