<?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">
<!-- 注册School-->
<!-- 注册Student-->
<bean id="myStudent" class="com.gqc.di10.Student">
<property name="name" value="张三"/>
<property name="age" value="11" />
<property name="school" > <!-- 内部bean 不让外部访问它 只在内部用 -->
<bean id="mySchool" class="com.gqc.di10.School">
<property name="name" value="清华大学" />
</bean>
</property>
</bean>
</beans>
内部Bean
最新推荐文章于 2023-11-22 05:04:52 发布