alibaba / dubbo-spring-boot-starter

Dubbo Spring Boot Starter
Apache License 2.0
2.1k stars 745 forks source link

Allow global filters by spring properties #72

Closed codefromthecrypt closed 6 years ago

codefromthecrypt commented 6 years ago

My demo is only waiting one feature before it is perfect (in my opinion). I don't want to have to use dubbo.properties to specify a filter. I want spring properties to do that, as the options are more flexible.

Concretely, I want to move from dubbo.properties:

dubbo.provider.filter=tracing
dubbo.consumer.filter=tracing

into application.properties

spring.dubbo.provider.filter=tracing
spring.dubbo.consumer.filter=tracing

I think this can be done by adding nested class for consumer and provider to DubboProperties, then processing it like other things are. It can be as simple as only handling filter attribute for now (not doing other things that are supported in xml or dubbo.properties)

Do you feel this is ok?

codefromthecrypt commented 6 years ago

here's example showing this feature last thing missing https://github.com/openzipkin/sleuth-webmvc-example/compare/add-dubbo-tracing

xionghuiCoder commented 6 years ago

Hi, we will consider to support it in version 1.0.3.

And in this version, we can use filter by hard-coding or annotation without dubbo.properties, for example: provider: System.setProperty("dubbo.provider.filter", "tracing"); or @Service(interfaceClass = Api.class, registry = "N/A", filter = "tracing")

consumer: System.setProperty("dubbo. consumer.filter", "tracing"); or @Reference(url = "dubbo://127.0.0.1:9000", filter = "tracing") Api api;