1. 程式人生 > >標籤系列一:spring 中beans解釋以及beans標籤裡面的屬性

標籤系列一:spring 中beans解釋以及beans標籤裡面的屬性

一、beans解釋:

    英文解釋:The top level (typically root) element. Allows the definition of default values for all nested bean definitions.

    上句翻譯:頂層(通常為根)元素。允許定義所有巢狀bean定義的預設值。

二、beans標籤裡面的屬性(name為屬性名,default為預設值,type為=“ ”引號裡面填的型別):

    下面的屬性bean裡面也有,請參考我的bean的解釋和屬性文章。

    1、name="default-lazy-init

"     default="false"     type="xsd:boolean"

    2、name="default-merge"       default="false"     type="xsd:boolean"

    3、name="default-autowire"     default="no"

    4、name="default-autowire-candidates"     type="xsd:string"

    5、name="default-init-method"     type="xsd:string"

    6、name="default-destroy-method

"     type="xsd:string"

三、beans標籤下一層的標籤(ref為下一層標籤名字,minOccurs為最小出現次數,maxOccurs為最多出現次數):

    1、ref="description"     minOccurs="0"

     英文解釋:Contains informative text describing the purpose of the enclosing element. Used primarily for user documentation of XML bean definition documents.

     上句翻譯:包含描述封閉元素用途的資訊性文字。主要用於XML bean定義文件的使用者文件。

    2、choice為在裡面選擇一個

    <xsd:choice     minOccurs="0"     maxOccurs="unbounded">

            <xsd:element     ref="import"/>

            <xsd:element     ref="alias"/>

            <xsd:element     ref="bean"/>

    </xsd:choice>

    2.1、<import>標籤:
     

      英文解釋:Specifies an XML bean definition resource to import.

     上句翻譯:指定要匯入的XML bean定義資源。

    <import>標籤的屬性(use為改屬性是否必須出現):

           (1)、name="resource"     type="xsd:string"     use="required"                       

                    英文解釋:The relative resource location of the XML (bean definition) file to import, for example "myImport.xml" or "includes/myImport.xml" or "../myImport.xml".

         上句翻譯:要匯入的XML(bean定義)檔案的相對資源位置,例如“myImport.xml”或“includes / myImport.xml”或“../myImport.xml”。

    2.2、<alias>標籤:

        英文解釋:Defines an alias for a bean (which can reside in a different definition resource).

       上句翻譯:定義bean的別名(可以駐留在不同的定義資源中)。

       <alias>標籤的屬性:

             (1)、name="name"      type="xsd:string"      use="required"

                        英文解釋:The name of the bean to define an alias for.

                        上句翻譯:用於定義別名的bean的名稱。

             (2)、name="alias"     type="xsd:string"     use="required"

                         英文解釋:The alias name to define for the bean.

                         上句翻譯:要為bean定義的別名。

    2.3、<bean>請參考我的bean的解釋和屬性文章。