java

关注公众号 jb51net

关闭
首页 > 软件编程 > java > Spring Consider defining a bean of type ‘xxx.xxx.xxx.Xxx‘ in your configuration

解决Spring运行时报错:Consider defining a bean of type ‘xxx.xxx.xxx.Xxx‘ in your configuration

作者:m0_58119778

该文章主要讲述了在使用Spring框架时,如果遇到某个bean未找到的错误,应该在配置文件中定义该bean,解决方法是在对应的类上添加@Component注解

问题

Description:

Parameter 0 of constructor in xx.xxx.xxx.Xxx required a bean of type 'xxx.xxx.xxx.Xxx' that could not be found.

分析

Consider defining a bean of type 'xxx.xxx.xxx.Xxx' in your configuration.

考虑定义一个类型为`xxx.xxx.xxx.Xxx`在配置中。

解决方案

由分析可知,Xxx类(此次出的问题bean包下的Xxx类)应该加上@Component即可。

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持脚本之家。

您可能感兴趣的文章:
阅读全文