question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `EnableDubbo` annotation to dubbo

See original GitHub issue

@EnableDubbo 等价于 @DubboComponentScan@EnableDubboConfig 组合:

示例代码

服务端配置

@EnableDubbo(basePackages = "com.alibaba.dubbo.config.spring.context.annotation")
@PropertySource("META-INF/dubbb-provider.properties")
@EnableTransactionManagement
public static class TestProviderConfiguration {
}

dubbo-provider.properties:

# Dubbo Provider Properties as an alternative for
# Spring XML Bean definition : META-INF/spring/dubbo-annotation-provider.xml

demo.service.application = dubbo-annotation-provider
demo.service.protocol = dubbo
demo.service.registry = my-registry


## Dubbo configs binding properties

### <dubbo:application name="dubbo-annotation-provider"/>
dubbo.application.id = dubbo-annotation-provider
dubbo.application.name = Dubbo Provider

### <dubbo:registry id="my-registry" address="N/A"/>
dubbo.registry.id = my-registry
dubbo.registry.address = N/A

### <dubbo:protocol name="dubbo" port="12345"/>
dubbo.protocol.id = dubbo
dubbo.protocol.name = dubbo
dubbo.protocol.port = 12345

客户端配置

@EnableDubbo(basePackageClasses = TestConsumerConfiguration.class, multipleConfig = true)
@PropertySource("META-INF/dubbb-consumer.properties")
@EnableTransactionManagement
public class TestConsumerConfiguration {
}

META-INF/dubbb-consumer.properties

# Dubbo Consumer Properties as an alternative for
# Spring XML Bean definition : META-INF/spring/dubbo-annotation-consumer.xml

demo.service.application = dubbo-annotation-consumer
demo.service.registry = my-registry

## Dubbo configs binding properties
###  <dubbo:application name="dubbo-annotation-consumer"/>
dubbo.application.dubbo-annotation-consumer.name = Dubbo Consumer
dubbo.application.dubbo-annotation-consumer2.name = dubbo-consumer2

### <dubbo:registry id="my-registry" address="N/A"/>
dubbo.registry.my-registry.address = N/A
dubbo.registry.my-registry2.address = N/A

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
mercyblitzcommented, Dec 25, 2017

@willlau0524 本周发布

1reaction
willliang1991commented, Dec 22, 2017

赞,希望Spring Boot相关的使用文档可以更加详细

Read more comments on GitHub >

github_iconTop Results From Across the Web

Annotation Configuration - Apache Dubbo
Annotation Configuration ; @DubboService public class AnnotationServiceImpl implements AnnotationService ; @Configuration @EnableDubbo( · = "org.apache.dubbo.
Read more >
Add `EnableDubbo` annotation to dubbo · Issue #1015 - GitHub
Dubbo Provider Properties as an alternative for # Spring XML Bean definition : META-INF/spring/dubbo-annotation-provider.xml ...
Read more >
Use Annotation in Apache Dubbo - DZone
Learn how to use annotation in Apache Dubbo. ... @EnableDubbo combines both @EnableDubboConfig and ... Add Configuration for the Service.
Read more >
com.lizo.spring.dubbo.boot.annotation.EnableDubbo java code ...
Created by lizhou on 2017/2/28/028. */ @SpringBootApplication @ComponentScan(basePackages = "com.lizo.spring.dubbo.demo") @EnableDubbo(basePackages ...
Read more >
Dubbo Spring Boot Auto-Configure - Google Git
If your project failed to resolve the dependency, try to add the following ... If you'd like to learn more , please read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found