注释类型 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 0String
application
已过时。Do not set it and use the global Application Configboolean
async
Whether to enable async invocation, default value is falseString
cache
Specify cache implementation for service invocation, legal values include: lru, threadlocal, jcacheint
callbacks
The callback instance limit peer connectionString
cluster
Cluster strategy, legal values include: failover, failfast, failsafe, failback, forking you can useClusterRules.FAIL_FAST
……int
connections
Maximum connections service provider can accept, default value is 0 - connection is sharedint
delay
Delay time for service registration, default value is 0boolean
deprecated
Whether the service is deprecated, default value is falseString
document
Service doc, default value is ""boolean
dynamic
Whether the service is dynamic, default value is trueint
executes
Maximum concurrent executes for the service, default value is 0 - no limitsboolean
export
Whether to export service, default value is trueboolean
exportAsync
Weather the service is export asynchronouslyString[]
filter
Filters for service invocationString
group
Service group, default value is empty stringClass<?>
interfaceClass
Interface class, default value is void.classString
interfaceName
Interface class name, default value is empty stringString
layer
Service layer, default value is empty stringString[]
listener
Listeners for service exporting and unexportingString
loadbalance
Load balance strategy, legal values include: random, roundrobin, leastactive you can useLoadbalanceRules.RANDOM
……String
local
已过时。Method[]
methods
methods supportString
mock
Service mock name, use interface name + Mock if not setString
module
Module spring bean nameString
monitor
Monitor spring bean nameString
onconnect
Callback method name when connected, default value is empty stringString
ondisconnect
Callback method name when disconnected, default value is empty stringString
owner
Service owner, default value is empty stringString[]
parameters
Customized parameter key-value pair, for example: {key1, value1, key2, value2}String
path
Service path, default value is empty stringString[]
protocol
Protocol spring bean namesString
provider
Provider spring bean nameString
proxy
How the proxy is generated, legal values include: jdk, javassistboolean
register
Whether to register the service to register center, default value is trueString[]
registry
Registry spring bean nameint
retries
Service invocation retry timesString
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 falseString
stub
Service stub name, use interface name + Local if not setString
tag
Service tag nameint
timeout
Timeout value for service invocation, default value is 0String
token
Service token, default value is falseString
validation
Whether to use JSR303 validation, legal values are: true, falseString
version
Service version, default value is empty stringint
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- 默认值:
- ""
-
-
-
token
String token
Service token, default value is false- 默认值:
- ""
-
-
-
accesslog
String accesslog
Access log for the service, default value is ""- 默认值:
- ""
-
-
-
document
String document
Service doc, default value is ""- 默认值:
- ""
-
-
-
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 useClusterRules.FAIL_FAST
……- 默认值:
- ""
-
-
-
proxy
String proxy
How the proxy is generated, legal values include: jdk, javassist- 默认值:
- ""
-
-
-
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 useLoadbalanceRules.RANDOM
……- 默认值:
- ""
-
-
-
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- 默认值:
- ""
-
-
-
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 ConfigApplication 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
- 默认值:
- ""
-
-