配置文件:
在使用的时候也有注解
在服务器启动时报错:
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)}
这个加了的,图上有。不好意思,调试出来了~