123456789101112131415161718192021 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
- xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd">
- <!-- 扫描的包-->
- <context:component-scan base-package="com"></context:component-scan>
- <!--实例化user-->
- <bean id="user1" class="com.sf.entity.User">
- <property name="userId" value="1001"></property>
- <property name="userName" value="admin"></property>
- <property name="age" value="18"></property>
- </bean>
- <!-- 实例化student-->
- <bean id="student" parent="user1" class="com.sf.entity.Student" scope="prototype">
- <property name="gender" value="男"></property>
- </bean>
- </beans>
|