报错:A component required a bean of type ‘xxx.xxx.x.xxxx.‘ that could not be found
原因:也就是没有成功将bean注入。1、检查代码controller层、Service层、Dao层2、使用自动注解:配置类写@Configuration;扫描组件@ComponentScan;还要在配置类中定义bean,例如:@BeanpublicYuApiClientyuApiClient(){returnnewYuApiClient(accessKey,secretKey);}3、以上都没错,