关于Spring mvc service不能注入的问题

配置文件:

在使用的时候也有注解

在服务器启动时报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'CommentController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private CommentService CommentController.commentService; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [CommentService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

第1个回答  2013-11-08
CommentService 这个类也加上@Service注解就行了。追问

这个加了的,图上有。不好意思,调试出来了~

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网