如何解决控制器中构造函数的参数0需要另一个包中类型为仓库类的Bean
尽管我在pom.xml中添加了包含我的GemDaoImpl存储库类的软件包,但它给出了错误:
Parameter 0 of constructor in com.bfm.accounting.portfolio.controller.PortfolioApiController required a bean of type 'com.bfm.app.reporting.gem.dao.impl.GemDaoImpl' that could not be found.
Action:
Consider defining a bean of type 'com.bfm.app.reporting.gem.dao.impl.GemDaoImpl' in your configuration.
能帮我解决这个错误吗?
解决方法
尝试在XML的component-scan元素中提及包含GemDaoImpl的软件包
public class TestShape {
public static void main(String[] args){
Shape s1 = new Circle(2.0);
System.out.println(s1.getCircumference());
}
}
或者如果您使用的是基于类的配置,请使用
<context:component-scan base-package="com.mkyong.customer" />
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。