Spring Autowiring Service doesn't work in my Controller

前端 未结 7 2003
时光说笑
时光说笑 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条回答
  •  旧时难觅i
    2021-02-04 14:31

    Make sure that your UserServiceImpl is in same package as defined in context:component-scan. If it's not, spring will not be able to detect it. Also, try removing value attribute from UserServiceImpl definition, since there is only 1 bean of that type. Spring will be able to autowire it by type.

提交回复
热议问题