spring 的几种简单的注入方式
0 以普通的方式
<bean id="some1" class="web.eagle.spring.Some">
<property name="name">
<value>eagle1</value>
</property>
</bean>
1 以map的方式注入
<property name="someMap">
<map>
<entry key="EagleMapTest">
<value>hello ealge</value>
</entry>
<entry key="someKey1">
<ref bean="some1" />
</entry>
</map>
</property>
2 以list的方式注入
<property name="someList">
<list>
<value>eagle List Test</value>
<ref bean="some1" />
<ref bean="some2" />
</list>
</property>
3 数据连接
<bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName">
<value>oracle.jdbc.driver.OracleDriver</value>
</property>
<property name="url">
<value>jdbc:oracle:thin:@127.0.0.1:1521:cqeagle</value>
</property>
<property name="username">
<value>eagle</value>
</property>
<property name="password">
<value>eagle</value>
</property>
</bean>
java群 16687158 欢迎你的加入,来一起讨论,学习!