JumpFunction jumpFunction; //设置注入
public void setJumpFunction(JumpFunction jumpFunction) {
this.jumpFunction = jumpFunction;
}
JumpFunction jumpFunction;// 构造器注入
public CatImp(JumpFunction jumpFunction) {
this.jumpFunction = jumpFunction;
}
<bean id="cat" class="com.kuma.Test2.CatImp">
<!-- 设置注入 -->
<!-- <property name="jumpFunction" ref="jumpFunction"></property>-->
<!-- 构造器注入 -->
<constructor-arg name="jumpFunction" ref="jumpFunction"></constructor-arg>
</bean>
<bean id="jumpFunction" class="com.kuma.Test2.JumpFunction"></bean>