---
title: "继承“JdbcDaoSupport”后，报“The hierarchy of the type AccoutDaoImpl is inconsistent”的解决方案"
author: "Rainbow702"
date: "2015-09-27T21:39:25Z"
tags: []
categories: ["编程语言"]
slug: "jdbcdaosupport-the-hierarchy-of-the-type-accoutdaoimpl-is-inconsistent"
draft: false
lastmod: "2015-09-27T21:40:33Z"
id: 2246435
url: "https://rainbow702.iteye.com/blog/2246435"
---

今天写了一段很简单的代码，Eclipse竟然报错

```
import org.springframework.jdbc.core.support.JdbcDaoSupport;

import com.rainbow.springdemo.dao.AccountDao;

public class AccoutDaoImpl extends JdbcDaoSupport implements AccountDao {

	@Override
	public void outMoney(String out, Double money) {

	}

	@Override
	public void inMoney(String in, Double money) {

	}
}
```

报的错为

```
The hierarchy of the type AccoutDaoImpl is inconsistent
```

后然，发现，只要不继承“JdbcDaoSupport”就不会报错。那么问题肯定就是出在“JdbcDaoSupport”上了。但是JdbcDaoSupport所在的jar我也放在classpath里了啊，所以就比较郁闷了。后来在stackoverflow上找到了一篇贴子：[http://stackoverflow.com/questions/9633118/eclipse-the-hierarchy-of-the-type-is-inconsistent-with-configurable-annotat](http://stackoverflow.com/questions/9633118/eclipse-the-hierarchy-of-the-type-is-inconsistent-with-configurable-annotat)

根据这篇贴子的描述，我就追踪了了下 JdbcDaoSupport 的类继承图，发现它继承自 DaoSupport，而 DaoSupport 又实现了 InitializingBean。问题就出在 InitializingBean 上，因为它是属于“spring-beans”jar包了，而我没却没有把这个包放在classpath中，真是笨死了。

找到原因之后，赶紧把“spring-beans-4.1.6.RELEASE.jar”添加进classpath中，结果就OK了。