Annotation Type 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.
Since:
2.7.7
  • Optional Element Summary

    Optional Elements
    Modifier and Type
    Optional Element
    Description
    Access log for the service, default value is empty string
    int
    Maximum active requests allowed, default value is -1
    Deprecated.
    This attribute was deprecated, use bind application/module of spring ApplicationContext
    boolean
    Whether to enable async invocation, default value is false
    Specify cache implementation for service invocation, legal values include: lru, threadlocal, jcache
    int
    The callback instance limit peer connection
    Cluster strategy, legal values include: failover, failfast, failsafe, failback, forking you can use ClusterRules.FAIL_FAST ……
    int
    Maximum connections service provider can accept, default value is -1 - connection is shared
    int
    Delay time for service registration, default value is -1
    boolean
    Whether the service is deprecated, default value is false
    Service doc, default value is empty string
    boolean
    Whether the service is dynamic, default value is true
    int
    Maximum concurrent executes for the service, default value is -1 - no limits
    bean name of service executor(thread pool), used for thread pool isolation between services
    boolean
    Whether to export service, default value is true
    boolean
    Weather the service is export asynchronously
    Filters for service invocation
    Service group, default value is empty string
    Interface class, default value is void.class
    Interface class name, default value is empty string
    Service layer, default value is empty string
    Listeners for service exporting and unexporting
    Load balance strategy, legal values include: random, roundrobin, leastactive you can use LoadbalanceRules.RANDOM ……
    Deprecated. 
    methods support
    Service mock name, use interface name + Mock if not set
    Module spring bean name
    Monitor spring bean name
    Callback method name when connected, default value is empty string
    Callback method name when disconnected, default value is empty string
    Service owner, default value is empty string
    Customized parameter key-value pair, for example:
    Service path, default value is empty string
    Payload max length.
    If the parameter has a value, the consumer will read the parameter first.
    Protocol spring bean names
    Provider spring bean name
    How the proxy is generated, legal values include: jdk, javassist
    boolean
    Whether to register the service to register center, default value is true
    Registry spring bean name
    int
    Service invocation retry times
    the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
    boolean
    Whether the async request has already been sent, the default value is false
    The serialization type
    Service stub name, use interface name + Local if not set
    Service tag name
    int
    Timeout value for service invocation, default value is -1
    Service token, default value is empty string
    Whether to use JSR303 validation, legal values are: true, false
    Service version, default value is empty string
    int
    Service weight value, default value is -1
  • Element Details

    • interfaceClass

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

      String interfaceName
      Interface class name, default value is empty string
      Default:
      ""
    • version

      String version
      Service version, default value is empty string
      Default:
      ""
    • group

      String group
      Service group, default value is empty string
      Default:
      ""
    • path

      String path
      Service path, default value is empty string
      Default:
      ""
    • export

      boolean export
      Whether to export service, default value is true
      Default:
      true
    • token

      String token
      Service token, default value is empty string
      Default:
      ""
    • deprecated

      boolean deprecated
      Whether the service is deprecated, default value is false
      Default:
      false
    • dynamic

      boolean dynamic
      Whether the service is dynamic, default value is true
      Default:
      true
    • accesslog

      String accesslog
      Access log for the service, default value is empty string
      Default:
      ""
    • executes

      int executes
      Maximum concurrent executes for the service, default value is -1 - no limits
      Default:
      -1
    • register

      boolean register
      Whether to register the service to register center, default value is true
      Default:
      true
    • weight

      int weight
      Service weight value, default value is -1
      Default:
      -1
    • document

      String document
      Service doc, default value is empty string
      Default:
      ""
    • delay

      int delay
      Delay time for service registration, default value is -1
      Default:
      -1
    • local

      String local
      Deprecated.
      See Also:
      Default:
      ""
    • stub

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

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

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

      int connections
      Maximum connections service provider can accept, default value is -1 - connection is shared
      Default:
      -1
    • callbacks

      int callbacks
      The callback instance limit peer connection

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

      Default:
      -1
    • onconnect

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

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

      String owner
      Service owner, default value is empty string
      Default:
      ""
    • layer

      String layer
      Service layer, default value is empty string
      Default:
      ""
    • retries

      int retries
      Service invocation retry times
      See Also:
      Default:
      -1
    • loadbalance

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

      boolean async
      Whether to enable async invocation, default value is false
      Default:
      false
    • actives

      int actives
      Maximum active requests allowed, default value is -1
      Default:
      -1
    • sent

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

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

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

      int timeout
      Timeout value for service invocation, default value is -1
      Default:
      -1
    • cache

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

      String[] filter
      Filters for service invocation
      See Also:
      • invalid reference
        Filter
      Default:
      {}
    • listener

      String[] listener
      Listeners for service exporting and unexporting
      See Also:
      • invalid reference
        ExporterListener
      Default:
      {}
    • parameters

      String[] parameters
      Customized parameter key-value pair, for example:
        ["a","b"] ==> {a=b}
        [" a "," b "] ==> {a=b}
        ["a=b"] ==>{a=b}
        ["a:b"] ==>{a=b}
        ["a=b","c","d"] ==>{a=b,c=d}
        ["a","a:b"] ==>{a="a:b"}
        ["a","a,b"] ==>{a="a,b"}
       
      See Also:
      • invalid reference
        org.apache.dubbo.config.spring.util.DubboAnnotationUtils#convertParameters(java.lang.String[])
      Default:
      {}
    • application

      @Deprecated String application
      Deprecated.
      This attribute was deprecated, use bind application/module of spring ApplicationContext
      Application spring bean name
      Default:
      ""
    • module

      String module
      Module spring bean name
      Default:
      ""
    • provider

      String provider
      Provider spring bean name
      Default:
      ""
    • protocol

      String[] protocol
      Protocol spring bean names
      Default:
      {}
    • monitor

      String monitor
      Monitor spring bean name
      Default:
      ""
    • registry

      String[] registry
      Registry spring bean name
      Default:
      {}
    • tag

      String tag
      Service tag name
      Default:
      ""
    • methods

      Method[] methods
      methods support
      Returns:
      Default:
      {}
    • scope

      String scope
      the scope for referring/exporting a service, if it's local, it means searching in current JVM only.
      See Also:
      • invalid reference
        org.apache.dubbo.rpc.Constants#SCOPE_LOCAL
      • invalid reference
        org.apache.dubbo.rpc.Constants#SCOPE_REMOTE
      Default:
      ""
    • exportAsync

      boolean exportAsync
      Weather the service is export asynchronously
      Default:
      false
    • executor

      String executor
      bean name of service executor(thread pool), used for thread pool isolation between services
      Returns:
      Default:
      ""
    • payload

      String payload
      Payload max length.
      Default:
      ""
    • serialization

      String serialization
      The serialization type
      Default:
      ""
    • preferSerialization

      String preferSerialization
      If the parameter has a value, the consumer will read the parameter first. If the Dubbo Sdk you are using contains the serialization type, the serialization method specified by the argument is used.

      When this parameter is null or the serialization type specified by this parameter does not exist in the Dubbo SDK, the serialization type specified by serialization is used. If the Dubbo SDK if still does not exist, the default type of the Dubbo SDK is used. For Dubbo SDK >= 3.2, preferSerialization takes precedence over serialization

      The configuration supports multiple, which are separated by commas.Such as:fastjson2,fastjson,hessian2

      Default:
      ""