UnsatisfiedDependencyException: Error creating bean with name

后端 未结 19 998
遇见更好的自我
遇见更好的自我 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:06

    I know it seems too late, but it may help others in future.

    I face the same error and the problem was that spring boot did not read my services package so add:

    @ComponentScan(basePackages = {"com.example.demo.Services"}) (you have to specify your own path to the services package) and in the class demoApplication (class that have main function) and for service interface must be annotated @Service and the class that implement the service interface must be annotated with @Component, then autowired the service interface.

提交回复
热议问题