注释类型 DubboService


  • @Documented
    @Retention(RUNTIME)
    @Target({TYPE,METHOD})
    @Inherited
    public @interface DubboService
    Class-level annotation used for declaring Dubbo service.

    1. Using with java config bean:

    This usage is recommended.
    It is more flexible on bean methods than on implementation classes, and is more compatible with Spring.

     @Configuration
     class ProviderConfiguration {
    
         @Bean
         @DubboService(group="demo")
         public DemoService demoServiceImpl() {
             return new DemoServiceImpl();
         }
     }
     
    2. Using on implementation class of service:
     @DubboService(group="demo")
     public class DemoServiceImpl implements DemoService {
         ...
     }
     
    This usage causes the implementation class to rely on the Dubbo module.
    从以下版本开始:
    2.7.7
    • 可选元素概要

      可选元素 
      修饰符和类型 可选元素 说明
      String accesslog
      Access log for the service, default value is ""
      int actives
      Maximum active requests allowed, default value is 0
      String application
      已过时。
      Do not set it and use the global Application Config
      boolean async
      Whether to enable async invocation, default value is false
      String cache
      Specify cache implementation for service invocation, legal values include: lru, threadlocal, jcache
      int callbacks
      The callback instance limit peer connection
      String cluster
      Cluster strategy, legal values include: failover, failfast, failsafe, failback, forking you can use ClusterRules.FAIL_FAST ……
      int connections
      Maximum connections service provider can accept, default value is 0 - connection is shared
      int delay
      Delay time for service registration, default value is 0
      boolean deprecated
      Whether the service is deprecated, default value is false
      String document
      Service doc, default value is ""
      boolean dynamic
      Whether the service is dynamic, default value is true
      int executes
      Maximum concurrent executes for the service, default value is 0 - no limits
      boolean export
      Whether to export service, default value is true
      boolean exportAsync
      Weather the service is export asynchronously
      String[] filter
      Filters for service invocation
      String group
      Service group, default value is empty string
      Class<?> interfaceClass
      Interface class, default value is void.class
      String interfaceName
      Interface class name, default value is empty string
      String layer
      Service layer, default value is empty string
      String[] listener
      Listeners for service exporting and unexporting
      String loadbalance
      Load balance strategy, legal values include: random, roundrobin, leastactive you can use LoadbalanceRules.RANDOM ……
      String local
      已过时。 
      Method[] methods
      methods support
      String mock
      Service mock name, use interface name + Mock if not set
      String module
      Module spring bean name
      String monitor
      Monitor spring bean name
      String onconnect
      Callback method name when connected, default value is empty string
      String ondisconnect
      Callback method name when disconnected, default value is empty string
      String owner
      Service owner, default value is empty string
      String[] parameters
      Customized parameter key-value pair, for example: {key1, value1, key2, value2}
      String path
      Service path, default value is empty string
      String[] protocol
      Protocol spring bean names
      String provider
      Provider spring bean name
      String proxy
      How the proxy is generated, legal values include: jdk, javassist
      boolean register
      Whether to register the service to register center, default value is true
      String[] registry
      Registry spring bean name
      int retries
      Service invocation retry times
      String scope
      the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
      boolean sent
      Whether the async request has already been sent, the default value is false
      String stub
      Service stub name, use interface name + Local if not set
      String tag
      Service tag name
      int timeout
      Timeout value for service invocation, default value is 0
      String token
      Service token, default value is false
      String validation
      Whether to use JSR303 validation, legal values are: true, false
      String version
      Service version, default value is empty string
      int weight
      Service weight value, default value is 0
    • 元素详细资料

      • interfaceClass

        Class<?> interfaceClass
        Interface class, default value is void.class
        默认值:
        void.class
      • interfaceName

        String interfaceName
        Interface class name, default value is empty string
        默认值:
        ""
      • version

        String version
        Service version, default value is empty string
        默认值:
        ""
      • group

        String group
        Service group, default value is empty string
        默认值:
        ""
      • path

        String path
        Service path, default value is empty string
        默认值:
        ""
      • export

        boolean export
        Whether to export service, default value is true
        默认值:
        true
      • token

        String token
        Service token, default value is false
        默认值:
        ""
      • deprecated

        boolean deprecated
        Whether the service is deprecated, default value is false
        默认值:
        false
      • dynamic

        boolean dynamic
        Whether the service is dynamic, default value is true
        默认值:
        true
      • accesslog

        String accesslog
        Access log for the service, default value is ""
        默认值:
        ""
      • executes

        int executes
        Maximum concurrent executes for the service, default value is 0 - no limits
        默认值:
        -1
      • register

        boolean register
        Whether to register the service to register center, default value is true
        默认值:
        true
      • weight

        int weight
        Service weight value, default value is 0
        默认值:
        -1
      • document

        String document
        Service doc, default value is ""
        默认值:
        ""
      • delay

        int delay
        Delay time for service registration, default value is 0
        默认值:
        -1
      • local

        String local
        已过时。
        另请参阅:
        stub()
        默认值:
        ""
      • stub

        String stub
        Service stub name, use interface name + Local if not set
        默认值:
        ""
      • cluster

        String cluster
        Cluster strategy, legal values include: failover, failfast, failsafe, failback, forking you can use ClusterRules.FAIL_FAST ……
        默认值:
        ""
      • proxy

        String proxy
        How the proxy is generated, legal values include: jdk, javassist
        默认值:
        ""
      • connections

        int connections
        Maximum connections service provider can accept, default value is 0 - connection is shared
        默认值:
        -1
      • callbacks

        int callbacks
        The callback instance limit peer connection

        see org.apache.dubbo.common.constants.CommonConstants.DEFAULT_CALLBACK_INSTANCES

        默认值:
        -1
      • onconnect

        String onconnect
        Callback method name when connected, default value is empty string
        默认值:
        ""
      • ondisconnect

        String ondisconnect
        Callback method name when disconnected, default value is empty string
        默认值:
        ""
      • owner

        String owner
        Service owner, default value is empty string
        默认值:
        ""
      • layer

        String layer
        Service layer, default value is empty string
        默认值:
        ""
      • loadbalance

        String loadbalance
        Load balance strategy, legal values include: random, roundrobin, leastactive you can use LoadbalanceRules.RANDOM ……
        默认值:
        ""
      • async

        boolean async
        Whether to enable async invocation, default value is false
        默认值:
        false
      • actives

        int actives
        Maximum active requests allowed, default value is 0
        默认值:
        -1
      • sent

        boolean sent
        Whether the async request has already been sent, the default value is false
        默认值:
        false
      • mock

        String mock
        Service mock name, use interface name + Mock if not set
        默认值:
        ""
      • validation

        String validation
        Whether to use JSR303 validation, legal values are: true, false
        默认值:
        ""
      • timeout

        int timeout
        Timeout value for service invocation, default value is 0
        默认值:
        -1
      • cache

        String cache
        Specify cache implementation for service invocation, legal values include: lru, threadlocal, jcache
        默认值:
        ""
      • filter

        String[] filter
        Filters for service invocation
        另请参阅:
        Filter
        默认值:
        {}
      • listener

        String[] listener
        Listeners for service exporting and unexporting
        另请参阅:
        ExporterListener
        默认值:
        {}
      • parameters

        String[] parameters
        Customized parameter key-value pair, for example: {key1, value1, key2, value2}
        默认值:
        {}
      • application

        @Deprecated
        String application
        已过时。
        Do not set it and use the global Application Config
        Application spring bean name
        默认值:
        ""
      • module

        String module
        Module spring bean name
        默认值:
        ""
      • provider

        String provider
        Provider spring bean name
        默认值:
        ""
      • protocol

        String[] protocol
        Protocol spring bean names
        默认值:
        {}
      • monitor

        String monitor
        Monitor spring bean name
        默认值:
        ""
      • registry

        String[] registry
        Registry spring bean name
        默认值:
        {}
      • tag

        String tag
        Service tag name
        默认值:
        ""
      • methods

        Method[] methods
        methods support
        返回:
        默认值:
        {}
      • scope

        String scope
        the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
        另请参阅:
        org.apache.dubbo.rpc.Constants#SCOPE_LOCAL, org.apache.dubbo.rpc.Constants#SCOPE_REMOTE
        默认值:
        ""
      • exportAsync

        boolean exportAsync
        Weather the service is export asynchronously
        默认值:
        false