diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/bootstrap/DubboConsumerDemo.java b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/bootstrap/DubboConsumerDemo.java index 705101ae5..7f10d51ea 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/bootstrap/DubboConsumerDemo.java +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/bootstrap/DubboConsumerDemo.java @@ -17,8 +17,9 @@ package com.alibaba.boot.dubbo.demo.consumer.bootstrap; import com.alibaba.boot.dubbo.demo.consumer.controller.DemoConsumerController; -import org.springframework.boot.SpringApplication; + import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.boot.builder.SpringApplicationBuilder; /** * Dubbo Consumer Demo @@ -31,9 +32,8 @@ public class DubboConsumerDemo { public static void main(String[] args) { - - SpringApplication.run(DubboConsumerDemo.class,args); - + new SpringApplicationBuilder(DubboConsumerDemo.class) + .profiles("prod") + .run(args); } - } diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/controller/DemoConsumerController.java b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/controller/DemoConsumerController.java index 5b105d601..f125b23bd 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/controller/DemoConsumerController.java +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/java/com/alibaba/boot/dubbo/demo/consumer/controller/DemoConsumerController.java @@ -15,8 +15,10 @@ * limitations under the License. */ package com.alibaba.boot.dubbo.demo.consumer.controller; + import com.alibaba.boot.dubbo.demo.consumer.DemoService; import com.alibaba.dubbo.config.annotation.Reference; + import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; @@ -32,7 +34,6 @@ public class DemoConsumerController { @Reference(version = "${demo.service.version}", - application = "${dubbo.application.id}", url = "dubbo://localhost:12345") private DemoService demoService; diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application-prod.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application-prod.properties new file mode 100644 index 000000000..523ba0de6 --- /dev/null +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application-prod.properties @@ -0,0 +1,7 @@ +# Application properties on prod profile +# Dubbo Endpoint (default status is disable) +endpoints.dubbo.enabled = true + +# Dubbo Health +## StatusChecker Name defaults (default : "memory", "load" ) +management.health.dubbo.status.defaults = memory \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties index dbca83749..c6e2da38d 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-consumer/src/main/resources/application.properties @@ -8,21 +8,10 @@ management.security.enabled = false demo.service.version = 1.0.0 # Dubbo Config properties -## ApplicationConfig Bean -dubbo.application.id = dubbo-consumer-demo -dubbo.application.name = dubbo-consumer-demo - ## Legacy QOS Config dubbo.qos.port = 22223 ## ProtocolConfig Bean dubbo.protocol.id = dubbo dubbo.protocol.name = dubbo -dubbo.protocol.port = 12345 - -# Dubbo Endpoint (default status is disable) -endpoints.dubbo.enabled = true - -# Dubbo Health -## StatusChecker Name defaults (default : "memory", "load" ) -management.health.dubbo.status.defaults = memory \ No newline at end of file +dubbo.protocol.port = 12345 \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java index db3fcf115..70a99d7cc 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/bootstrap/DubboProviderDemo.java @@ -17,6 +17,7 @@ package com.alibaba.boot.dubbo.demo.provider.bootstrap; import com.alibaba.boot.dubbo.demo.provider.service.DefaultDemoService; + import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; @@ -31,11 +32,9 @@ public class DubboProviderDemo { public static void main(String[] args) { - new SpringApplicationBuilder(DubboProviderDemo.class) + .profiles("prod") .web(false) .run(args); - } - } diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/service/DefaultDemoService.java b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/service/DefaultDemoService.java index 48bfc22bf..01ff1c6a5 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/service/DefaultDemoService.java +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/java/com/alibaba/boot/dubbo/demo/provider/service/DefaultDemoService.java @@ -28,7 +28,6 @@ */ @Service( version = "${demo.service.version}", - application = "${dubbo.application.id}", protocol = "${dubbo.protocol.id}", registry = "${dubbo.registry.id}" ) diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application-prod.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application-prod.properties new file mode 100644 index 000000000..421a14005 --- /dev/null +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application-prod.properties @@ -0,0 +1,9 @@ +# Application properties on prod profile +# Dubbo Endpoint (default status is disable) +endpoints.dubbo.enabled = true + +# Dubbo Health +## StatusChecker Name defaults (default : "memory", "load" ) +management.health.dubbo.status.defaults = memory +## StatusChecker Name extras (default : empty ) +management.health.dubbo.status.extras = load,threadpool \ No newline at end of file diff --git a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties index 5828a7fe3..d0d1f2c91 100644 --- a/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties +++ b/dubbo-spring-boot-samples/dubbo-spring-boot-sample-provider/src/main/resources/application.properties @@ -1,7 +1,6 @@ # Spring boot application spring.application.name = dubbo-provider-demo server.port = 9090 -management.port = 9091 management.security.enabled = false # Service Version @@ -10,11 +9,8 @@ demo.service.version = 1.0.0 # Base packages to scan Dubbo Components (e.g @Service , @Reference) dubbo.scan.basePackages = com.alibaba.boot.dubbo.demo.provider.service - # Dubbo Config properties ## ApplicationConfig Bean -dubbo.application.id = dubbo-provider-demo -dubbo.application.name = dubbo-provider-demo dubbo.application.qos.port=22222 dubbo.application.qos.enable=true @@ -26,13 +22,4 @@ dubbo.protocol.status = server ## RegistryConfig Bean dubbo.registry.id = my-registry -dubbo.registry.address = N/A - -# Dubbo Endpoint (default status is disable) -endpoints.dubbo.enabled = true - -# Dubbo Health -## StatusChecker Name defaults (default : "memory", "load" ) -management.health.dubbo.status.defaults = memory -## StatusChecker Name extras (default : empty ) -management.health.dubbo.status.extras = load,threadpool \ No newline at end of file +dubbo.registry.address = N/A \ No newline at end of file