Spring Autowiring Service doesn't work in my Controller

前端 未结 7 1974
时光说笑
时光说笑 2021-02-04 13:43

i\'ve problems in order to autowire a service in my controller. I\'ve this error:

org.springframework.beans.factory.BeanCreationException: Error creating bean wi         


        
7条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-02-04 14:12

    On first glance the config seems ok, yet there may be some smaller tripwires that might be not that obvious.

    a) implemented UserService interface, is it the same as the controller needs? Dumb question, I know, but just be on the safe side.

    b) bean name: Try eradicating the value-value (ba-da-tush) from the @Service annotation, its superflous anyway. Or be more specific with the help of an @Qualifier.

    c) package scanning: Double check if your implemented service is really within es.unican.meteo. Sometimes its the small things.

提交回复
热议问题