config.xml简化为:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="teacher" class="BeanTeacher" factory-method="aspectOf">
<property name="response">
<value>"we'll have none of that please..."</value>
</property>
</bean>
<bean id="girl" class="Girl">
<property name="kissable">
<ref bean="boy"/>
</property>
</bean>
<bean id="boy" class="Boy">
</bean>
</beans>
关键在于在Main中通过
beanFactory.getBean("teacher");
强制初始化aspect。
本文地址:http://com.8s8s.com/it/it12814.htm