Springboot出现 org.springframework.beans.factory.BeanCreationException 异常的原因及解决方法

Springboot出现 org.springframework.beans.factory.BeanCreationException 异常的原因及解决方法

出现异常错误信息:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘xxxxxxx’....

此异常,为:注入 bean 失败异常。

导致 bean 注入失败的原因包括以下几种但不限于这几种:

对应的 bean 没有添加注解;
对应的 bean 添加注解错误;
选择错误的自动注入方法等。

解决方案:
既然知道了出现此异常的原因,找到对应bean查看是否添加注解:

@Autowired
TestService testService;

 

你可能感兴趣的:(Cx_架构之旅,spring,boot,异常解决)