zoukankan      html  css  js  c++  java
  • dubbo源码阅读-配置(三)之xml配置原理

    dubbo各个配置类图

    寻找dubbo schema定义

    项目目录

    xsd定义

    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
                xmlns:beans="http://www.springframework.org/schema/beans"
                xmlns:tool="http://www.springframework.org/schema/tool"
                xmlns="http://dubbo.apache.org/schema/dubbo"
                targetNamespace="http://dubbo.apache.org/schema/dubbo">
    
        <xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
        <xsd:import namespace="http://www.springframework.org/schema/beans"/>
        <xsd:import namespace="http://www.springframework.org/schema/tool"/>
    
        <xsd:annotation>
            <xsd:documentation>
                <![CDATA[ Namespace support for the dubbo services provided by dubbo framework. ]]></xsd:documentation>
        </xsd:annotation>
    
        <xsd:complexType name="abstractMethodType">
            <xsd:attribute name="timeout" type="xsd:string" use="optional" default="0">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The method invoke timeout. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="retries" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The method retry times. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="actives" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The max active requests. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="connections" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        <![CDATA[ The exclusive connections. default share one connection. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="loadbalance" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The method load balance. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="async" type="xsd:string" use="optional" default="false">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The method does async. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="sent" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The async method return await message sent ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="mock" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Use service mock implementation. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="merger" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The multi-group result merger ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="validation" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Use service jsr303 validation, true/false. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="cache" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Use service cache, lru/threadlocal/jcache. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="abstractInterfaceType">
            <xsd:complexContent>
                <xsd:extension base="abstractMethodType">
                    <xsd:attribute name="id" type="xsd:ID">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="local" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Use service local implementation. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="stub" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Use service local implementation. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="proxy" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Use proxy factory. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="cluster" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Use cluster strategy. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="forks" type="xsd:string">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="filter" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The filter. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="listener" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The listener. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="owner" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The owner. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="layer" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ layer info. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="application" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service application. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="module" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service module. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="registry" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service registry. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="monitor" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service monitor. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="callbacks" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The callback instance limit peer connection.]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="onconnect" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service client connected. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="ondisconnect" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service client disconnected. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="scope" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Defines the service visibility, choise:[local remote]. default is remote, which can be invoked by network。  ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="abstractReferenceType">
            <xsd:complexContent>
                <xsd:extension base="abstractInterfaceType">
                    <xsd:attribute name="version" type="xsd:string" use="optional" default="0.0.0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service version. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="group" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service group. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="check" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Check dependency providers. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="init" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Eager init reference. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="generic" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Generic service. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="injvm" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[Deprecated. Replace to  set scope=local ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="sticky" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Enable/Disable cluster sticky policy.Default false ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="reconnect" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ remoting reconnect timer. false represent close reconnect. integer represent interval(ms) .default true(2000ms).]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="lazy" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ lazy create connection. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="abstractServiceType">
            <xsd:complexContent>
                <xsd:extension base="abstractInterfaceType">
                    <xsd:attribute name="register" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service can be register to registry. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="version" type="xsd:string" use="optional" default="0.0.0">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service version. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="group" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service group. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="deprecated" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ whether the service is deprecated. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="delay" type="xsd:string" use="optional" default="0">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The service export delay millisecond. ]]>
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="export" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The service is export. ]]>
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="weight" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The service weight. ]]>
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="document" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The service document. ]]>
                            </xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="dynamic" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ the service registered to the registry is dynamic(true) or static(false). ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="token" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service use token. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="accesslog" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service use accesslog. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="executes" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service allow execute requests. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="protocol" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service protocol. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="warmup" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The warmup time in Milliseconds. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="serialization" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The serialization protocol of service. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="tag" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Defines the service tag]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:anyAttribute namespace="##other" processContents="lax"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="applicationType">
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="id" type="xsd:ID">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="name" type="xsd:string" use="required">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application name. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="version" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application version. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="owner" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application owner name (email prefix). ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="organization" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The organization name. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="architecture" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The architecture. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="environment" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application environment, eg: dev/test/run ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="compiler" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The java code compiler. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="logger" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application logger. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="registry" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application registry. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="monitor" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The application monitor. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="default" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="moduleType">
            <xsd:attribute name="id" type="xsd:ID">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="name" type="xsd:string" use="required">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module name. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="version" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module version. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="owner" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module owner name (email prefix). ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="organization" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module organization. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="registry" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module registry. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="monitor" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The module monitor. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="default" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="registryType">
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="id" type="xsd:ID">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="address" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry address. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="port" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry default port. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="protocol" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry lookup protocol. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="username" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry username. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="password" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry password. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="transport" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol transporter type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="transporter" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol transporter type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="server" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol server type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="client" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol client type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="cluster" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry cluster type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="forks" type="xsd:string">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ ForkingCluster forks. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="group" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry group. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="version" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry version. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="timeout" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The request timeout. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="session" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The session timeout. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="file" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The registry adddress file store. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="wait" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The wait time for shutdown. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="check" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Check registry status on stratup. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="dynamic" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        <![CDATA[ the service registered to this registry is dynamic(true) or static(false). ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="register" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        <![CDATA[ register service to this registry(true) or not(false). ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="subscribe" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        <![CDATA[ subscribe service to this registry(true) or not(false). ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="default" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="monitorType">
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="address" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor address. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="protocol" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor protocol. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="username" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor username. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="password" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor password. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="group" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor group. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="version" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor version. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="interval" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The monitor interval. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="default" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="parameterType">
            <xsd:attribute name="key" type="xsd:string" use="required">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The parameter key. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="value" type="xsd:string" use="required">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The parameter value. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="hide" type="xsd:boolean" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Hide parameter. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="methodType">
            <xsd:complexContent>
                <xsd:extension base="abstractMethodType">
                    <xsd:choice minOccurs="0" maxOccurs="unbounded">
                        <xsd:element ref="argument" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:choice>
                    <xsd:attribute name="name" type="xsd:string" use="required">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The method name (method.toString()). ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="executes" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The max active requests. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="stat" type="xsd:string" use="optional" default="-1">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The method parameter index for statistics. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="retry" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Deprecated. Replace to retries. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="reliable" type="xsd:string" use="optional" default="false">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Deprecated. Replace to napoli protocol. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="deprecated" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The method deprecated. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="sticky" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Enable/Disable cluster sticky policy.Default false ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="return" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Method result is return. default is true.]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="oninvoke" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Method invoke trigger.]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="onreturn" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Method return trigger. return attribute must be true.]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="onthrow" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Method on error trigger.return attribute must be true.]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="argumentType">
            <xsd:attribute name="index" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The argument index. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="type" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The argument type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="callback" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The argument is callback. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:complexType name="consumerType">
            <xsd:complexContent>
                <xsd:extension base="abstractReferenceType">
                    <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                        <xsd:element ref="reference" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:sequence>
                    <xsd:attribute name="default" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="client" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Transporter layer framework: netty mina.... ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="threadpool" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Consumer threadpool: cached, fixed, limited, eager]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="corethreads" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool core threads size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="threads" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="queues" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool queue size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:anyAttribute namespace="##other" processContents="lax"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="referenceType">
            <xsd:complexContent>
                <xsd:extension base="abstractReferenceType">
                    <xsd:choice minOccurs="0" maxOccurs="unbounded">
                        <xsd:element ref="method" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:choice>
                    <xsd:attribute name="interface" type="xsd:token" use="required">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service interface class name. ]]></xsd:documentation>
                            <xsd:appinfo>
                                <tool:annotation>
                                    <tool:expected-type type="java.lang.Class"/>
                                </tool:annotation>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="url" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Provider list url. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="client" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Protocol transport client type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="consumer" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Deprecated. Replace to reference-default. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="protocol" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service protocol. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:anyAttribute namespace="##other" processContents="lax"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="protocolType">
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
            </xsd:sequence>
            <xsd:attribute name="id" type="xsd:ID">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="name" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol name. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="host" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The service host. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="port" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The service port. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="threadpool" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The thread pool type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="threads" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The thread pool size. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="iothreads" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The IO thread pool size. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="queues" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The thread pool queue size. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="accepts" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The accept connection size. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="codec" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol codec. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="serialization" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol serialization. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="keepalive" type="xsd:boolean" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol keepAlive. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="optimizer" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The serialization optimizer. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="extension" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The extension for protocol. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="charset" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol charset. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="payload" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The max payload. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="buffer" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The buffer size. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="heartbeat" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The heartbeat interval.(ms) ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="accesslog" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol use accesslog. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="telnet" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol use telnet commands. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="prompt" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol telnet prompt. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="status" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol check status. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="transporter" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol transporter type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="exchanger" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol exchanger type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="dispather" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Deprecated. replace to "dispatcher". ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="dispatcher" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol dispatcher type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="networker" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol "networker" type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="server" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol server type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="client" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol client type. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="path" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation>
                        <![CDATA[ The protocol context path. replace to "contextpath". ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="contextpath" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol context path. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="register" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The protocol can be register to registry. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="default" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:anyAttribute namespace="##other" processContents="lax"/>
        </xsd:complexType>
    
        <xsd:complexType name="providerType">
            <xsd:complexContent>
                <xsd:extension base="abstractServiceType">
                    <xsd:choice minOccurs="0" maxOccurs="unbounded">
                        <xsd:element ref="service" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:choice>
                    <xsd:attribute name="host" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service host. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="port" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service port. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="threadpool" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="threads" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="iothreads" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The IO thread pool size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="queues" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The thread pool queue size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="accepts" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The accept connection size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="codec" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol codec. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="charset" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol charset. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="payload" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The max payload. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="buffer" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The buffer size. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="transporter" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol transporter type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="exchanger" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol exchanger type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="dispather" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Deprecated. replace to "dispatcher". ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="dispatcher" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol dispatcher type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="networker" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol "networker" type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="server" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol server type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="client" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol client type. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="telnet" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol use telnet commands. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="prompt" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol telnet prompt. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="status" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol check status. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="path" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The protocol context path. replace to "contextpath". ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="contextpath" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The protocol context path. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="wait" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The provider shutdown wait time. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="default" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Is default. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:anyAttribute namespace="##other" processContents="lax"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="serviceType">
            <xsd:complexContent>
                <xsd:extension base="abstractServiceType">
                    <xsd:choice minOccurs="0" maxOccurs="unbounded">
                        <xsd:element ref="method" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="parameter" minOccurs="0" maxOccurs="unbounded"/>
                        <xsd:element ref="beans:property" minOccurs="0" maxOccurs="unbounded"/>
                    </xsd:choice>
                    <xsd:attribute name="interface" type="xsd:token" use="required">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ Defines the interface to advertise for this service in the service registry. ]]></xsd:documentation>
                            <xsd:appinfo>
                                <tool:annotation>
                                    <tool:expected-type type="java.lang.Class"/>
                                </tool:annotation>
                            </xsd:appinfo>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="ref" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation>
                                <![CDATA[ The service implementation instance bean id. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="class" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service implementation class name. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="path" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ The service path. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="provider" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Deprecated. Replace to protocol. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:attribute name="generic" type="xsd:string" use="optional">
                        <xsd:annotation>
                            <xsd:documentation><![CDATA[ Generic service. ]]></xsd:documentation>
                        </xsd:annotation>
                    </xsd:attribute>
                    <xsd:anyAttribute namespace="##other" processContents="lax"/>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    
        <xsd:complexType name="annotationType">
            <xsd:attribute name="id" type="xsd:ID">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The unique identifier for a bean. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
            <xsd:attribute name="package" type="xsd:string" use="optional">
                <xsd:annotation>
                    <xsd:documentation><![CDATA[ The scan package. ]]></xsd:documentation>
                </xsd:annotation>
            </xsd:attribute>
        </xsd:complexType>
    
        <xsd:element name="annotation" type="annotationType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The annotation config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="application" type="applicationType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The application config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="module" type="moduleType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The module config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="registry" type="registryType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The registry config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="monitor" type="monitorType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The logstat monitor config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="provider" type="providerType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ Export service default config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="consumer" type="consumerType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ Service reference default config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="protocol" type="protocolType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ Service provider config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="service" type="serviceType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ Export service config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="reference" type="referenceType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ Reference service config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="method" type="methodType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The service method config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="argument" type="argumentType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The service argument config ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
        <xsd:element name="parameter" type="parameterType">
            <xsd:annotation>
                <xsd:documentation><![CDATA[ The service url parameter ]]></xsd:documentation>
            </xsd:annotation>
        </xsd:element>
    
    </xsd:schema>
    View Code

    NamespaceHandle实现

    public class DubboNamespaceHandler extends NamespaceHandlerSupport {
    
        static {
            //避免重复定义 Handler
            Version.checkDuplicate(DubboNamespaceHandler.class);
        }
    
        @Override
        public void init() {
            /**
             * 解析各个标签配置
             * 可参考http://dubbo.apache.org/zh-cn/docs/user/references/xml/dubbo-service.html
             */
            registerBeanDefinitionParser("application", new DubboBeanDefinitionParser(ApplicationConfig.class, true));
            registerBeanDefinitionParser("module", new DubboBeanDefinitionParser(ModuleConfig.class, true));
            registerBeanDefinitionParser("registry", new DubboBeanDefinitionParser(RegistryConfig.class, true));
            registerBeanDefinitionParser("monitor", new DubboBeanDefinitionParser(MonitorConfig.class, true));
            registerBeanDefinitionParser("provider", new DubboBeanDefinitionParser(ProviderConfig.class, true));
            registerBeanDefinitionParser("consumer", new DubboBeanDefinitionParser(ConsumerConfig.class, true));
            registerBeanDefinitionParser("protocol", new DubboBeanDefinitionParser(ProtocolConfig.class, true));
            registerBeanDefinitionParser("service", new DubboBeanDefinitionParser(ServiceBean.class, true));
            registerBeanDefinitionParser("reference", new DubboBeanDefinitionParser(ReferenceBean.class, false));
            registerBeanDefinitionParser("annotation", new AnnotationBeanDefinitionParser());
        }
    
    }

    spring.handlers配置

    http://dubbo.apache.org/schema/dubbo=com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler
    http://code.alibabatech.com/schema/dubbo=com.alibaba.dubbo.config.spring.schema.DubboNamespaceHandler

    spring.schemas配置

    http://dubbo.apache.org/schema/dubbo/dubbo.xsd=META-INF/dubbo.xsd
    http://code.alibabatech.com/schema/dubbo/dubbo.xsd=META-INF/compat/dubbo.xsd

    DubboBeanDefinitionParser

    public class DubboBeanDefinitionParser implements BeanDefinitionParser {
    
        private static BeanDefinition parse(Element element, ParserContext parserContext, Class<?> beanClass, boolean required) {
            RootBeanDefinition beanDefinition = new RootBeanDefinition();
            //set解析的BeanClass
            beanDefinition.setBeanClass(beanClass);
            //是否是懒加载 如果是是懒加载 getBean才初始化
            beanDefinition.setLazyInit(false);
            //获取配置的id
            String id = element.getAttribute("id");
            String className;
            int len$;
            //如果id为空 同时必须配置id required 外面register设置
            if ((id == null || id.length() == 0) && required) {
                //获得name
                className = element.getAttribute("name");
                if (className == null || className.length() == 0) {
                    //ProtocolConfig 的name为dubbo
                    if (ProtocolConfig.class.equals(beanClass)) {
                        className = "dubbo";
                    } else {
                        //获取interface配置
                        className = element.getAttribute("interface");
                    }
                }
    
                //className还为空 则获取 外部register传入的beanClass的name
                if (className == null || className.length() == 0) {
                    className = beanClass.getName();
                }
    
                id = className;
    
                /*
                 * 由于spring的bean id不能重复,但有些标签可能会配置多个如:dubbo:registry
                 * 所以 id 在后面加数字 2、3、4 区分
                 */
                for(len$ = 2; parserContext.getRegistry().containsBeanDefinition(id); id = className + len$++) {
                    ;
                }
            }
    
            if (id != null && id.length() > 0) {
                //检查是否有重复定义的bean
                if (parserContext.getRegistry().containsBeanDefinition(id)) {
                    throw new IllegalStateException("Duplicate spring bean id " + id);
                }
                /*
                 * 注册 bean 定义
                 * org.springframework.beans.factory.support.DefaultListableBeanFactory#registerBeanDefinition
                 * 会按照 id 即beanName做一些检查,判断是否重载已加载过的bean等等
                 * 跟到代码里其实 bean 的注册也是放到 ConcurrentHashMap 里
                 * beanName也就是这里的 id 会放到 list 里
                 */
                parserContext.getRegistry().registerBeanDefinition(id, beanDefinition);
                /**
                 * 给bean定义设置id
                 */
                beanDefinition.getPropertyValues().addPropertyValue("id", id);
            }
    
            if (ProtocolConfig.class.equals(beanClass)) {
                String[] arr$ = parserContext.getRegistry().getBeanDefinitionNames();
                len$ = arr$.length;
    
                for(int i$ = 0; i$ < len$; ++i$) {
                    String name = arr$[i$];
                    BeanDefinition definition = parserContext.getRegistry().getBeanDefinition(name);
                    PropertyValue property = definition.getPropertyValues().getPropertyValue("protocol");
                    if (property != null) {
                        Object value = property.getValue();
                        if (value instanceof ProtocolConfig && id.equals(((ProtocolConfig)value).getName())) {
                            /**
                             * 当我们需要动态注入Bean,并给该Bean的属性注入其他Bean时,
                             * 比如在Mybatis和Spring的整合中,我们需要动态注入Mapper到spring容器中,
                             * 而该Mapper如果需要执行SQL语句,还需要持有SqlSessionFactory的引用。
                             * 但是我们注入时,可能对应的Bean还没有准备好,这时,我们就可以使用RuntimeBeanReference,
                             * 以保持对实际Bean的引用。在Spring处理依赖关系时,最终会将该引用替换成实际生成的Bean对象
                             */
                            definition.getPropertyValues().addPropertyValue("protocol", new RuntimeBeanReference(id));
                        }
                    }
                }
            } else if (ServiceBean.class.equals(beanClass)) {
                //获得class
                className = element.getAttribute("class");
                if (className != null && className.length() > 0) {
                    RootBeanDefinition classDefinition = new RootBeanDefinition();
                    //通过反射获取类
                    classDefinition.setBeanClass(ReflectUtils.forName(className));
                    classDefinition.setLazyInit(false);
                    /*
                     *   解析子节点,有些配置可能是:
                     *   <dubbo:service interface="com.alihealth.dubbo.api.drugInfo.service.DemoService" executes="10">
                     *       <property name="ref" ref="demoService"></property>
                     *       <property name="version" value="1.0.0"></property>
                     *   </dubbo:service>
                     */
                    parseProperties(element.getChildNodes(), classDefinition);
                    /**
                     * ref直接取com.alihealth.dubbo.api.drugInfo.service.DemoServiceImpl
                     */
                    beanDefinition.getPropertyValues().addPropertyValue("ref", new BeanDefinitionHolder(classDefinition, id + "Impl"));
                }
            } else if (ProviderConfig.class.equals(beanClass)) {
                /*
                 *   <dubbo:provider 为缺省配置 ,所以在解析的时候,如果<dubbo:service有些值没配置,那么会用<dubbo:provider值进行填充 比如registory=false
                 */
                parseNested(element, parserContext, ServiceBean.class, true, "service", "provider", id, beanDefinition);
            } else if (ConsumerConfig.class.equals(beanClass)) {
                /*
                 *   <dubbo:consumer 为缺省配置 ,所以在解析的时候,如果<dubbo:consumer有些值没配置,那么会用<dubbo:consumer值进行填充
                 */
                parseNested(element, parserContext, ReferenceBean.class, false, "reference", "consumer", id, beanDefinition);
            }
    
            Set<String> props = new HashSet();
            ManagedMap parameters = null;
            //反射获得所有方法
            Method[] arr$ = beanClass.getMethods();
            int len = arr$.length;
    
            int i;
            String name;
            for(i = 0; i < len; ++i) {
                Method setter = arr$[i];
                name = setter.getName();
                //遍历所有set属性名字 并跟xml映射 并赋值
                if (name.length() > 3 && name.startsWith("set") && Modifier.isPublic(setter.getModifiers()) && setter.getParameterTypes().length == 1) {
                    Class<?> type = setter.getParameterTypes()[0];
                    String property = StringUtils.camelToSplitName(name.substring(3, 4).toLowerCase() + name.substring(4), "-");
                    props.add(property);
                    Method getter = null;
    
                    try {
                        getter = beanClass.getMethod("get" + name.substring(3));
                    } catch (NoSuchMethodException var22) {
                        try {
                            getter = beanClass.getMethod("is" + name.substring(3));
                        } catch (NoSuchMethodException var21) {
                            ;
                        }
                    }
    
                    if (getter != null && Modifier.isPublic(getter.getModifiers()) && type.equals(getter.getReturnType())) {
                        if ("parameters".equals(property)) {
                            parameters = parseParameters(element.getChildNodes(), beanDefinition);
                        } else if ("methods".equals(property)) {
                            parseMethods(id, element.getChildNodes(), beanDefinition, parserContext);
                        } else if ("arguments".equals(property)) {
                            parseArguments(id, element.getChildNodes(), beanDefinition, parserContext);
                        } else {
                            String value = element.getAttribute(property);
                            if (value != null) {
                                value = value.trim();
                                if (value.length() > 0) {
                                    if ("registry".equals(property) && "N/A".equalsIgnoreCase(value)) {
                                        RegistryConfig registryConfig = new RegistryConfig();
                                        registryConfig.setAddress("N/A");
                                        beanDefinition.getPropertyValues().addPropertyValue(property, registryConfig);
                                    } else if ("registry".equals(property) && value.indexOf(44) != -1) {
                                        parseMultiRef("registries", value, beanDefinition, parserContext);
                                    } else if ("provider".equals(property) && value.indexOf(44) != -1) {
                                        parseMultiRef("providers", value, beanDefinition, parserContext);
                                    } else if ("protocol".equals(property) && value.indexOf(44) != -1) {
                                        parseMultiRef("protocols", value, beanDefinition, parserContext);
                                    } else {
                                        Object reference;
                                        if (isPrimitive(type)) {
                                            if ("async".equals(property) && "false".equals(value) || "timeout".equals(property) && "0".equals(value) || "delay".equals(property) && "0".equals(value) || "version".equals(property) && "0.0.0".equals(value) || "stat".equals(property) && "-1".equals(value) || "reliable".equals(property) && "false".equals(value)) {
                                                value = null;
                                            }
    
                                            reference = value;
                                        } else if ("protocol".equals(property) && ExtensionLoader.getExtensionLoader(Protocol.class).hasExtension(value) && (!parserContext.getRegistry().containsBeanDefinition(value) || !ProtocolConfig.class.getName().equals(parserContext.getRegistry().getBeanDefinition(value).getBeanClassName()))) {
                                            if ("dubbo:provider".equals(element.getTagName())) {
                                                logger.warn("Recommended replace <dubbo:provider protocol="" + value + "" ... /> to <dubbo:protocol name="" + value + "" ... />");
                                            }
    
                                            ProtocolConfig protocol = new ProtocolConfig();
                                            protocol.setName(value);
                                            reference = protocol;
                                        } else {
                                            int index;
                                            String invokeRef;
                                            String invokeRefMethod;
                                            if ("onreturn".equals(property)) {
                                                index = value.lastIndexOf(".");
                                                invokeRef = value.substring(0, index);
                                                invokeRefMethod = value.substring(index + 1);
                                                reference = new RuntimeBeanReference(invokeRef);
                                                beanDefinition.getPropertyValues().addPropertyValue("onreturnMethod", invokeRefMethod);
                                            } else if ("onthrow".equals(property)) {
                                                index = value.lastIndexOf(".");
                                                invokeRef = value.substring(0, index);
                                                invokeRefMethod = value.substring(index + 1);
                                                reference = new RuntimeBeanReference(invokeRef);
                                                beanDefinition.getPropertyValues().addPropertyValue("onthrowMethod", invokeRefMethod);
                                            } else if ("oninvoke".equals(property)) {
                                                index = value.lastIndexOf(".");
                                                invokeRef = value.substring(0, index);
                                                invokeRefMethod = value.substring(index + 1);
                                                reference = new RuntimeBeanReference(invokeRef);
                                                beanDefinition.getPropertyValues().addPropertyValue("oninvokeMethod", invokeRefMethod);
                                            } else {
                                                if ("ref".equals(property) && parserContext.getRegistry().containsBeanDefinition(value)) {
                                                    BeanDefinition refBean = parserContext.getRegistry().getBeanDefinition(value);
                                                    if (!refBean.isSingleton()) {
                                                        throw new IllegalStateException("The exported service ref " + value + " must be singleton! Please set the " + value + " bean scope to singleton, eg: <bean id="" + value + "" scope="singleton" ...>");
                                                    }
                                                }
    
                                                reference = new RuntimeBeanReference(value);
                                            }
                                        }
    
                                        beanDefinition.getPropertyValues().addPropertyValue(property, reference);
                                    }
                                }
                            }
                        }
                    }
                }
            }
    
            //xml所有属性
            NamedNodeMap attributes = element.getAttributes();
            len = attributes.getLength();
    
            for(i = 0; i < len; ++i) {
                Node node = attributes.item(i);
                name = node.getLocalName();
                //经过上面解析还有没解析到到的 统一放到parameters里面 比如age  但是ProviderConfig里面并没有setAge
                if (!props.contains(name)) {
                    if (parameters == null) {
                        parameters = new ManagedMap();
                    }
    
                    String value = node.getNodeValue();
                    parameters.put(name, new TypedStringValue(value, String.class));
                }
            }
    
            if (parameters != null) {
                beanDefinition.getPropertyValues().addPropertyValue("parameters", parameters);
            }
            //最终交接给spring初始化
            return beanDefinition;
        }
    }

    至此 所有config就可以理解成注入到了容器

    scheme扩展使用例子

    1.引入pom依赖

      <properties>
            <springframework.version>4.3.16.RELEASE</springframework.version>
        </properties>
        <dependencies>
            <!-- **************************** Spring 依赖 **************************** -->
            <!-- 添加Spring-core包 -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-core</artifactId>
                <version>${springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-expression</artifactId>
                <version>${springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${springframework.version}</version>
            </dependency>
            <!-- 添加spring-tx包 -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-tx</artifactId>
                <version>${springframework.version}</version>
            </dependency>
            <!-- 添加spring-context包 -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>${springframework.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-beans</artifactId>
                <version>${springframework.version}</version>
            </dependency>
        </dependencies>

    3.创建一个类 用于封装xml配置信息

    public class DemoConfig {
        private String interfaceFullName;
        private String refName;
    
        public String getInterfaceFullName() {
            return interfaceFullName;
        }
    
        public void setInterfaceFullName(String interfaceFullName) {
            this.interfaceFullName = interfaceFullName;
        }
    
        public String getRefName() {
            return refName;
        }
    
        public void setRefName(String refName) {
            this.refName = refName;
        }
    }

    3.定义xsd 即xml配置规范

    <?xml version="1.0" encoding="UTF-8"?>
    <!--targetNamespace为命名空间 随便填 后面会使用-->
    <xsd:schema xmlns="http://liqiang/schema/demo"
                xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:beans="http://www.springframework.org/schema/beans"
                targetNamespace="http://liqiang/schema/demo" elementFormDefault="qualified"
                attributeFormDefault="unqualified">
        <xsd:import namespace="http://www.springframework.org/schema/beans" />
        <!--标签名字-->
        <xsd:element name="service">
            <xsd:complexType>
                <xsd:complexContent>
                    <!--定义属性interface和ref 同时必填-->
                    <xsd:extension base="beans:identifiedType">
                        <xsd:attribute name="interface" type="xsd:string" use="required"/>
                        <xsd:attribute name="ref" type="xsd:string" use="required" />
                    </xsd:extension>
                </xsd:complexContent>
            </xsd:complexType>
        </xsd:element>
    
    </xsd:schema>

    4.创建sccema解析器

    //定义自定义的scheme解析器 我们只需要解析标签信息将要创建对象的描述信息封装到beanDefinitionBuilder对象 spring容器会根据这些描述信息为我们创建对象对象
    public class SimpleDateFormatBeanDefinitionParser extends AbstractSingleBeanDefinitionParser {
        @Override
        protected Class getBeanClass(Element element) {
            return DemoConfig.class;
        }
    
        @Override
        protected void doParse(Element element, BeanDefinitionBuilder bean) {
            //获取interface值
            String interfaceFullName = element.getAttribute("interface");
            //获取ref值
            String refName = element.getAttribute("ref");
            if (refName!=null) {
                bean.addPropertyValue("interfaceFullName", interfaceFullName);
            }
            if (refName!=null) {
                bean.addPropertyValue("refName", refName);
            }
        }
    }

    5.注册类

    import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
    
    /**
     * 注册自定义scheme解析器
     */
    public class MyNamespaceHandler extends NamespaceHandlerSupport {
        @Override
        public void init() {
            //解析标签的名字  xsd <xsd:element name="service">配置
            registerBeanDefinitionParser("service", new SimpleDateFormatBeanDefinitionParser());
        }

    6.resource目录创建META-INF子目录

    7.META-INF创建文件spring.handlers并配置

    http://liqiang/schema/demo.xsd=demo.xsd

    key=命名空间.xsd

    value=xsd路径

    8.META-INFO创建文件spring.handlers并配置

    http://liqiang/schema/demo=MyNamespaceHandler

    key=命名空间

    value=注册类的全名称

    9.创建spring.xml配置类

    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
           xmlns:demo="http://liqiang/schema/demo"
           xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://liqiang/schema/demo http://liqiang/schema/demo.xsd">
        <demo:service id="test" interface="com.liqiang.userService" ref="userServiceImpl"/>
    
    </beans>

    10.运行demo

    public class TestRun {
        public static void main(String[] args) {
            ApplicationContext ctx = new ClassPathXmlApplicationContext("demo.xml");
            DemoConfig dubboConfig = (DemoConfig) ctx.getBean("test");
            System.out.println(dubboConfig.getInterfaceFullName()+"|"+dubboConfig.getRefName());
    
        }
    }

    11.打印结果

    总结


    1.spring.xml配置文件解析是通过spring 2.0提供的schema实现

    2.在解析的过程中 解析标签config描述信息(BeanDefinition) 交给spring创建对应的Config比如RegisterConfig  ServiceConfig

    3.如果解析的标签对应的config没有对应的属性则统一存放到config的mapParamter里面存放

  • 相关阅读:
    .Net插件编程模型:MEF和MAF[转载]
    并行任务task
    wpf动画概述
    vs在线工具杂烩
    力挺8天入门wpf【转载】
    vs debug 快捷键
    Visual Studio® 2010 Web Deployment Projects站点编译生成bin同时发表插件
    EasyUI选项卡tab页面处理示例
    显示输入框只能输入的内容
    JqueryeasyUI选项卡选择判定更改内部Iframe地址
  • 原文地址:https://www.cnblogs.com/LQBlog/p/12448988.html
Copyright © 2011-2022 走看看