Injection-Type //setting注入 (重要) 接口注入(不重要) 构造函数注入 --根据索引传参
//bean 的id&name name可以用特殊字符
//简单属性注入 <property name="....",value="....">
//scope singleton为单列模式 prototype每次拿新对象 //集合装配
//自动装配autowire byName(默认的名字是XXXDAO) 和 byType 用得比较多
//生命周期 lazy-init 对整个beans初始化 (用得比较少) init-method init-destory(原理和servlet相似)一般不要和prototype连用
<?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.yanxi.spring.impl.userImpl">
<property name="daoid" value="2"></property>
</bean>
<bean name="userDAO1" class="com.yanxi.spring.impl.userImpl">
<property name="daoid" value="1"></property>
</bean>
<bean id="userService" class="com.yanxi.spring.service.UserService" init-method="init" destroy-method="destory" scope="prototype" autowire="byType">
<!-- <property name="userDAO" ref="u" /> -->//setting注入
<!-- <constructor-arg>//构造函数注入
<ref bean="u"/>
</constructor-arg> -->
</bean>
<!-- <bean id="userDao" class="com.yanxi.spring.impl.userImpl">
<property name="sets">
<set>
<value>1</value>
<value>2</value>
<value>3</value>
</set>
</property>
<property name="lists">
<list>
<value>4</value>
<value>5</value>
<value>6</value>
<value>7</value>
</list>
</property>
<property name="maps">
<map>
<entry key="1" value="8"></entry>
<entry key="2" value="8"></entry>
<entry key="3" value="8"></entry>
<entry key="4" value="8"></entry>
<entry key="5" value="8"></entry>
</map>
</property>
</bean> -->
</beans>