在春季3中替换方法问题

时间:2010-11-15 00:59:47

标签: spring

对不起。我是春天的初学者。现在,它有一些问题。
我正在阅读 Spring in action 并尝试MyEclipse中的代码。但是当我尝试被替换方法的代码时,会出现错误。

    <bean id="harry" class="com.springinaction.sprintidol.Magician">
    <property name="magicBox" ref="magicBox" />
    <property name="magicWords" value="Bippity boppity boo" />
</bean>

<bean id="magicBox" class="com.springinaction.sprintidol.MagicBoxImpl">
    <replaced-method name="getContents" replacer="tigerReplacer" />
</bean>

<bean id="tigerReplacer" class="com.springinaction.sprintidol.TigerReplacer" />


这是 applicationContext.xml 。例外情况如下:

Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'stevie' defined in class path resource [applicationContext.xml]: Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter

所有代码都来自本书。为什么我会得到例外?以及如何解决?

感谢。

1 个答案:

答案 0 :(得分:2)

我找到了原因。因为我没有包含Spring 3.0 Persistence Core Libraries。非常感谢。