<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<!-- init-method:注册初始化函数,destroy-method:注册消亡函数 -->
<bean id="conf" class="dbconf.Conf" init-method="init" destroy-method="destroy">
<!-- 构造函数注入值 index:表明在构造函数里面的参数序号 需要知道参数的 类型,不需知道参数的名字-->
<constructor-arg index="0" type="java.lang.String">
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</constructor-arg>
<constructor-arg index="1" type="java.lang.String">
<value>jdbc:odbc:mysql//localhost:3306/db</value>
</constructor-arg>
<!-- 属性注入 只需要知道属性名,而不需知道函数类型 -->
<!--
<property name="driverclass">
<value>sun.jdbc.odbc.JdbcOdbcDriver</value>
</property>
<property name="url">
<value>jdbc:odbc:mysql//localhost:3306/db</value>
</property>
-->
</bean>
</beans>