写作于
2022-10-13 23:07:46
发布于
2022-11-20 16:51:37
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name ‘com.jsss.community.MailTests’: Unsatisfied dependency expressed through field ‘mailClient’; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.jsss.util.MailClient’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
@Autowired(required=true)
private MailClient mailClient;
package com.jsss.util;
@Component
public class MailClient {
}
package com.jsss.community.util;
@Component
public class MailClient {
}
包创建位置创建错了,应该在主启动类所在包下,导致找不到bean