报错: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

报错:Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.aop.aop20250508_2.service.impl.AccountServiceImpl' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoMatchingBeanFound


原因是:大概是找不到bean或bean未被定义之类的,根据报错信息来看是在“com.aop.aop20250508_2.service.impl.AccountServiceImpl”这个类出的问题,然后发现

在第10行未添加注解“@Service”,加上之后解决了,如下所示:

posted @ 2025-05-08 21:09  里莉  阅读(741)  评论(0)    收藏  举报