夭寿啦,在启动Spring工程的时候,控制台报错
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘fm.douban.app.AppApplication’: Unsatisfied dependency expressed through field ‘songListControl’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘fm.douban.app.control.SongListControl’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
这个报错是注入失败,spring的bean没有扫描到完整的内容,检查了一下代码,发现是实现类的@Serice注解缺失没有加上
把@Service注解加上,再次启动就没有报错了,试了一下相关的注解,不管是实现类的@Service注解,还是控制类里面的@Controller和@Autowired注解缺失,都会出现这个bean扫描不完整的报错
【已解决】Spring下启动工程报错{@org.springframework.beans.factory.annotation.Autowired(required=true)}
最新推荐文章于 2024-05-31 06:15:00 发布