Spring17_配置文件知识要点5

发布时间 2023-04-27 17:36:03作者: 花溪月影

<bean>标签
  id属性:在容器中Bean实例的唯一标识,不允许重复
  class属性:要实例化的Bean的全限定名
  scope属性:Bean的作用范围,常用是Singleton(默认)和prototype
  <property>标签:属性注入,set方法注入使用
    name属性:属性名称
    value属性:注入的普通属性值
    ref属性:注入的对象引用值
    <list>标签
    <map>标签
    <properties>标签
  <constructor-arg>标签:有参构造注入,属性跟bean属性是一样的
<import>标签:导入其他的Spring的分文件