Spring 依赖注入两种方式

(1):通过 setter 方法注入:

          <property name=“ ” ></property>

     其中,name属性的取值依setter方法名而定,要求这个类里面这个对应的属性必须有setter方法

 (2):通过构造方法注入:

          <constructor-arg index=””></ constructor-arg>

     其中,index表示构造方法中的参数索引(第一个参数索引为)

     要求这个类里面必须有想对应的构造方法

mysql
原文地址:https://www.cnblogs.com/excellent-vb/p/7773400.html