【发布时间】:2011-12-12 19:22:38
【问题描述】:
我有一个界面
public interface ParentService{}
还有两个实现类
@Service("child1service")
public class Child1 implements ParentService{}
@Service("child2service")
public class Child2 implements ParentService{}
现在是我的控制器
public class ServeChild1Controller extendds AbstractController{
@Autowired
public ServeChild1Controller(@Qualifier("child1service") ParentService child1service){
super(child1service)
}
同样有ServeChild2Controller..
所以当我运行时出现以下错误
ServeChild1Controller 错误:没有定义类型为 [com.service.ParentService] 的唯一 bean:预期单个匹配 bean 但找到了 2 个 child1service、child2service
我正在尝试阅读有关这些注释的更多信息,但无法解决它.. 任何指示都会有所帮助 谢谢
【问题讨论】:
-
你用的是什么版本的 Spring?
-
我正在使用的spring 3.0.5版本
标签: java spring-mvc annotations