<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd">
<!-- 方法替换,将getDog替换成people2的getDog方法 -->
<bean id="people1" class="com.fx.entity.People">
<property name="id" value="1"></property>
<property name="name" value="张三"></property>
<property name="age" value="11"></property>
<replaced-method name="getDog" replacer="people2"></replaced-method>
</bean>
<!-- 声明people2实例 -->
<bean id="people2" class="com.fx.entity.People2"></bean>
</beans>
第六章 Spring4 方法替换
最新推荐文章于 2024-10-12 13:05:12 发布