spring_spring自动装配

来源:互联网 发布:ptc公司的软件 编辑:程序博客网 时间:2024/05/16 10:26
<?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"><bean name="userDao" class="com.bjsxd.dao.impl.UserDaoImpl"><property name="daoId" value="1"></property></bean><bean name="userDao2" class="com.bjsxd.dao.impl.UserDaoImpl"><property name="daoId" value="2"></property></bean><!-- <bean id="userService" class="com.bjsxd.service.UserService"> <property name="userDao" ref="userDaoImpl" /> </bean> --><bean id="userService" class="com.bjsxd.service.UserService" scope="prototype" autowire="byName"></bean></beans>

原创粉丝点击