├── .codecov.yml ├── spring-cloud-alibaba-dubbo ├── README.md └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ ├── dubbo │ │ │ ├── com.alibaba.dubbo.registry.RegistryFactory │ │ │ └── default │ │ │ │ └── actuator-endpoints.properties │ │ │ └── spring.factories │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── dubbo │ │ └── http │ │ ├── matcher │ │ ├── HttpRequestMatcher.java │ │ ├── MediaTypeExpression.java │ │ └── NameValueExpression.java │ │ └── HttpServerRequest.java │ └── test │ ├── resources │ ├── application.yaml │ └── bootstrap.yaml │ └── java │ └── com │ └── alibaba │ └── cloud │ └── dubbo │ ├── autoconfigure │ └── DubboServiceRegistrationAutoConfigurationTest.java │ └── http │ ├── matcher │ └── AbstractHttpRequestMatcherTest.java │ └── util │ └── HttpUtilsTest.java ├── spring-cloud-alibaba-examples ├── oss-example │ └── src │ │ └── main │ │ ├── resources │ │ ├── oss-test.json │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── examples │ │ └── OssApplication.java ├── nacos-example │ ├── nacos-discovery-example │ │ ├── nacos-discovery-spring-cloud-config-client │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ ├── application.yml │ │ │ │ └── bootstrap.yml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ ├── SpringCloudConfigClientApplication.java │ │ │ │ └── GetConfigController.java │ │ ├── nacos-discovery-consumer-example │ │ │ ├── scripts │ │ │ │ ├── error.sh │ │ │ │ ├── index.sh │ │ │ │ ├── sleep.sh │ │ │ │ ├── feign-error.sh │ │ │ │ └── feign-defaultmethod-error.sh │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ ├── flowrule.json │ │ │ │ ├── degraderule.json │ │ │ │ └── application.properties │ │ ├── nacos-discovery-provider-example │ │ │ └── src │ │ │ │ └── main │ │ │ │ └── resources │ │ │ │ └── application.properties │ │ ├── nacos-discovery-spring-cloud-config-server │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.yml │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ └── SpringCloudConfigServerApplication.java │ │ └── pom.xml │ ├── nacos-config-example │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ ├── application.properties │ │ │ └── bootstrap.properties │ └── nacos-gateway-example │ │ ├── nacos-gateway-provider-example │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ └── ProviderApplication.java │ │ ├── nacos-gateway-discovery-example │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ └── GatewayApplication.java │ │ └── pom.xml ├── sentinel-example │ ├── sentinel-core-example │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── system.json │ │ │ ├── degraderule.json │ │ │ ├── authority.json │ │ │ ├── param-flow.json │ │ │ ├── flowrule.json │ │ │ ├── flowrule.xml │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ ├── JsonFlowRuleListConverter.java │ │ │ ├── ExceptionUtil.java │ │ │ ├── ServiceApplication.java │ │ │ └── TestController.java │ ├── sentinel-dubbo-example │ │ ├── sentinel-dubbo-api │ │ │ ├── src │ │ │ │ └── main │ │ │ │ │ └── java │ │ │ │ │ └── com │ │ │ │ │ └── alibaba │ │ │ │ │ └── cloud │ │ │ │ │ └── examples │ │ │ │ │ └── FooService.java │ │ │ └── pom.xml │ │ ├── sentinel-dubbo-consumer-example │ │ │ └── src │ │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ └── FooServiceConsumer.java │ │ └── sentinel-dubbo-provider-example │ │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ ├── FooServiceImpl.java │ │ │ └── SentinelDubboProviderApp.java │ ├── sentinel-webflux-example │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── flowrule.json │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ └── SentinelWebFluxApplication.java │ ├── sentinel-spring-cloud-gateway-example │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── gateway.json │ │ │ ├── api.json │ │ │ └── application.yaml │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ └── SentinelSpringCloudGatewayApplication.java │ └── sentinel-zuul-example │ │ └── src │ │ └── main │ │ ├── resources │ │ ├── gateway.json │ │ ├── api.json │ │ └── application.yaml │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── examples │ │ └── SentinelZuulApplication.java ├── schedulerx-example │ └── schedulerx-simple-task-example │ │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ ├── TestService.java │ │ │ ├── ScxApplication.java │ │ │ ├── HelloController.java │ │ │ ├── TestController.java │ │ │ └── SimpleTask.java │ │ └── pom.xml ├── ans-example │ ├── ans-provider-example │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ └── ProviderApplication.java │ │ ├── readme-zh.md │ │ └── pom.xml │ ├── ans-consumer-feign-example │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ ├── EchoService.java │ │ │ │ └── ConsumerApplication.java │ │ └── readme-zh.md │ └── ans-consumer-ribbon-example │ │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── application.properties │ │ ├── readme-zh.md │ │ └── pom.xml ├── acm-example │ └── acm-local-example │ │ ├── src │ │ └── main │ │ │ ├── resources │ │ │ └── bootstrap.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ ├── AcmApplication.java │ │ │ └── EchoController.java │ │ ├── readme-zh.md │ │ └── pom.xml ├── seata-example │ ├── account-service │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ └── AccountApplication.java │ │ └── pom.xml │ ├── order-service │ │ ├── src │ │ │ └── main │ │ │ │ ├── resources │ │ │ │ └── application.properties │ │ │ │ └── java │ │ │ │ └── com │ │ │ │ └── alibaba │ │ │ │ └── cloud │ │ │ │ └── examples │ │ │ │ ├── Order.java │ │ │ │ └── OderApplication.java │ │ └── pom.xml │ ├── storage-service │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ └── application.properties │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── examples │ │ │ └── StorageApplication.java │ └── business-service │ │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── examples │ │ └── Order.java ├── spring-cloud-bus-rocketmq-example │ └── src │ │ └── main │ │ └── resources │ │ └── bootstrap.properties ├── sms-example │ └── src │ │ └── main │ │ ├── resources │ │ └── application.properties │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── example │ │ ├── SmsUpMessageListener.java │ │ ├── SmsReportMessageListener.java │ │ └── SmsApplication.java ├── spring-cloud-alibaba-dubbo-examples │ ├── spring-cloud-dubbo-servlet-gateway-sample │ │ └── src │ │ │ └── main │ │ │ ├── resources │ │ │ ├── application.yaml │ │ │ └── bootstrap.yaml │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── dubbo │ │ │ └── bootstrap │ │ │ └── DubboSpringCloudServletGatewayBootstrap.java │ ├── spring-cloud-dubbo-client-sample │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── bootstrap.yaml │ ├── spring-cloud-dubbo-server-sample │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ └── bootstrap.yaml │ ├── spring-cloud-dubbo-provider-sample │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ ├── application.yaml │ │ │ └── bootstrap.yaml │ ├── spring-cloud-dubbo-provider-web-sample │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ ├── application.yaml │ │ │ └── bootstrap.yaml │ ├── spring-cloud-dubbo-consumer-sample │ │ └── src │ │ │ └── main │ │ │ └── resources │ │ │ ├── application.yaml │ │ │ └── bootstrap.yaml │ └── spring-cloud-dubbo-sample-api │ │ ├── src │ │ └── main │ │ │ └── java │ │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── dubbo │ │ │ └── service │ │ │ ├── EchoService.java │ │ │ └── UserService.java │ │ └── pom.xml └── rocketmq-example │ ├── rocketmq-consume-example │ └── src │ │ └── main │ │ └── java │ │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── examples │ │ ├── Foo.java │ │ └── ReceiveService.java │ └── rocketmq-produce-example │ └── src │ └── main │ ├── java │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── examples │ │ └── Foo.java │ └── resources │ └── application.properties ├── .mvn ├── jvm.config ├── wrapper │ ├── maven-wrapper.jar │ └── maven-wrapper.properties └── maven.config ├── spring-cloud-stream-binder-rocketmq └── src │ └── main │ ├── resources │ └── META-INF │ │ ├── spring.binders │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── cloud │ └── stream │ └── binder │ └── rocketmq │ ├── RocketMQBinderConstants.java │ └── config │ └── RocketMQBinderHealthIndicatorAutoConfiguration.java ├── spring-cloud-alibaba-nacos-config-server └── src │ ├── test │ └── resources │ │ └── application.properties │ └── main │ └── resources │ └── META-INF │ └── spring.factories ├── spring-cloud-alibaba-sentinel └── src │ ├── test │ └── resources │ │ ├── system.json │ │ ├── degraderule.json │ │ ├── authority.json │ │ ├── param-flow.json │ │ └── flowrule.json │ └── main │ ├── java │ └── com │ │ └── alibaba │ │ └── cloud │ │ └── sentinel │ │ ├── custom │ │ └── SentinelCircuitBreakerConfiguration.java │ │ ├── SentinelConstants.java │ │ └── annotation │ │ └── SentinelRestTemplate.java │ └── resources │ └── META-INF │ └── spring.factories ├── spring-cloud-alibaba-sentinel-datasource └── src │ ├── test │ └── resources │ │ ├── flowrule.json │ │ ├── flowrule-errorcontent.json │ │ ├── flowrule-errorformat.json │ │ └── flowrule.xml │ └── main │ ├── resources │ └── META-INF │ │ └── sentinel-datasource.properties │ └── java │ └── com │ └── alibaba │ └── cloud │ └── sentinel │ └── datasource │ └── SentinelDataSourceConstants.java ├── spring-cloud-alicloud-schedulerx └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── alicloud │ └── scx │ └── ScxAutoConfiguration.java ├── spring-cloud-alicloud-sms └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── alicloud │ └── sms │ ├── SmsUpMessageListener.java │ ├── SmsReportMessageListener.java │ ├── base │ └── MessageListener.java │ ├── SmsMessageListener.java │ └── endpoint │ ├── SmsEndpoint.java │ └── SmsEndpointAutoConfiguration.java ├── spring-cloud-starter-alibaba ├── spring-cloud-starter-bus-rocketmq │ ├── src │ │ └── main │ │ │ └── resources │ │ │ └── META-INF │ │ │ └── spring.factories │ └── pom.xml ├── spring-cloud-starter-alibaba-seata │ └── pom.xml ├── spring-cloud-starter-alibaba-sentinel │ └── pom.xml ├── spring-cloud-starter-alibaba-nacos-config │ └── pom.xml ├── spring-cloud-starter-alibaba-nacos-discovery │ └── pom.xml ├── spring-cloud-starter-alibaba-nacos-config-server │ └── pom.xml ├── spring-cloud-starter-stream-rocketmq │ └── pom.xml ├── spring-cloud-starter-dubbo │ └── pom.xml └── pom.xml ├── spring-cloud-alicloud-oss └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── alicloud │ └── oss │ └── OssConstants.java ├── spring-cloud-alibaba-sentinel-gateway └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── cloud │ └── sentinel │ └── gateway │ └── ConfigConstants.java ├── spring-cloud-alicloud-acm └── src │ └── main │ └── resources │ └── META-INF │ ├── spring.factories │ └── additional-spring-configuration-metadata.json ├── PULL_REQUEST_TEMPLATE.md ├── spring-cloud-alicloud-ans └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ └── spring.factories │ └── java │ │ └── com │ │ └── alibaba │ │ └── alicloud │ │ └── ans │ │ ├── ConditionalOnAnsEnabled.java │ │ ├── ribbon │ │ ├── ConditionalOnRibbonAns.java │ │ └── AnsRibbonClientConfiguration.java │ │ └── endpoint │ │ └── AnsEndpointAutoConfiguration.java │ └── test │ └── java │ └── com │ └── alibaba │ └── alicloud │ └── ans │ └── test │ └── AnsMockTest.java ├── spring-cloud-alibaba-seata └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── cloud │ └── seata │ ├── feign │ ├── SeataFeignBuilder.java │ ├── SeataHystrixFeignBuilder.java │ ├── SeataSentinelFeignBuilder.java │ └── hystrix │ │ └── SeataHystrixAutoConfiguration.java │ ├── web │ └── SeataHandlerInterceptorConfiguration.java │ └── SeataProperties.java ├── spring-cloud-alibaba-nacos-config └── src │ └── main │ ├── resources │ └── META-INF │ │ └── spring.factories │ └── java │ └── com │ └── alibaba │ └── cloud │ └── nacos │ ├── refresh │ └── NacosRefreshProperties.java │ └── diagnostics │ └── analyzer │ └── NacosConnectionFailureAnalyzer.java ├── .gitignore ├── spring-cloud-alicloud-context └── src │ ├── main │ ├── resources │ │ └── META-INF │ │ │ ├── additional-spring-configuration-metadata.json │ │ │ └── spring.factories │ └── java │ │ └── com │ │ └── alibaba │ │ └── alicloud │ │ └── context │ │ ├── sms │ │ └── SmsContextAutoConfiguration.java │ │ ├── Constants.java │ │ └── ans │ │ └── AnsContextAutoConfiguration.java │ └── test │ └── java │ └── com │ ├── alibaba │ ├── alicloud │ │ ├── acm │ │ │ └── AcmAutoConfiguration.java │ │ ├── ans │ │ │ └── AnsAutoConfiguration.java │ │ ├── oss │ │ │ └── OssAutoConfiguration.java │ │ ├── scx │ │ │ └── ScxAutoConfiguration.java │ │ └── context │ │ │ └── ans │ │ │ └── AnsContextApplicationListenerTests.java │ ├── cloud │ │ └── nacos │ │ │ ├── NacosConfigAutoConfiguration.java │ │ │ └── NacosDiscoveryAutoConfiguration.java │ └── csp │ │ └── sentinel │ │ └── datasource │ │ └── nacos │ │ └── NacosDataSource.java │ └── aliyuncs │ └── dysmsapi │ └── model │ └── v20170525 │ └── SendSmsRequest.java ├── .github └── ISSUE_TEMPLATE │ ├── question.md │ ├── feature_request.md │ └── bug_report.md ├── spring-cloud-alibaba-nacos-discovery └── src │ ├── main │ ├── java │ │ └── com │ │ │ └── alibaba │ │ │ └── cloud │ │ │ └── nacos │ │ │ ├── ribbon │ │ │ ├── ExtendBalancer.java │ │ │ ├── ConditionalOnRibbonNacos.java │ │ │ └── NacosServerIntrospector.java │ │ │ └── ConditionalOnNacosDiscoveryEnabled.java │ └── resources │ │ └── META-INF │ │ ├── spring.factories │ │ └── additional-spring-configuration-metadata.json │ └── test │ └── java │ └── com │ └── alibaba │ └── cloud │ └── nacos │ └── test │ └── CommonTestConfig.java ├── spring-cloud-alibaba-docs └── src │ └── main │ ├── asciidoc │ ├── spring-cloud-alibaba.adoc │ └── dependency-management.adoc │ └── asciidoc-zh │ ├── spring-cloud-alibaba.adoc │ ├── dependency-management.adoc │ └── introduction.adoc ├── spring-cloud-starter-alicloud ├── spring-cloud-starter-alicloud-acm │ └── pom.xml ├── spring-cloud-starter-alicloud-sms │ └── pom.xml ├── spring-cloud-starter-alicloud-schedulerx │ └── pom.xml ├── spring-cloud-starter-alicloud-ans │ └── pom.xml ├── spring-cloud-starter-alicloud-oss │ └── pom.xml └── pom.xml ├── Roadmap-zh.md └── .circleci └── config.yml /.codecov.yml: -------------------------------------------------------------------------------- 1 | 2 | coverage: 3 | status: 4 | project: off 5 | patch: off -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/README.md: -------------------------------------------------------------------------------- 1 | ## Info 2 | 3 | 4 | 5 | ## Features 6 | 7 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/oss-example/src/main/resources/oss-test.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "oss-test" 3 | } -------------------------------------------------------------------------------- /.mvn/jvm.config: -------------------------------------------------------------------------------- 1 | -Xmx1024m -XX:CICompilerCount=1 -XX:TieredStopAtLevel=1 -Djava.security.egd=file:/dev/./urandom -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/2227324689/spring-cloud-alibaba/HEAD/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /.mvn/maven.config: -------------------------------------------------------------------------------- 1 | -DaltSnapshotDeploymentRepository=repo.spring.io::default::https://repo.spring.io/libs-snapshot-local -P spring 2 | -------------------------------------------------------------------------------- /.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo1.maven.org/maven2/org/apache/maven/apache-maven/3.5.2/apache-maven-3.5.2-bin.zip -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | config: config-from-yml -------------------------------------------------------------------------------- /spring-cloud-stream-binder-rocketmq/src/main/resources/META-INF/spring.binders: -------------------------------------------------------------------------------- 1 | rocketmq:com.alibaba.cloud.stream.binder.rocketmq.config.RocketMQBinderAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18084 2 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-config-server/src/test/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=nacos-config-server 2 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/resources/META-INF/dubbo/com.alibaba.dubbo.registry.RegistryFactory: -------------------------------------------------------------------------------- 1 | spring-cloud=com.alibaba.cloud.dubbo.registry.SpringCloudRegistryFactory -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/test/resources/system.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "highestSystemLoad": -1, 4 | "qps": 100, 5 | "avgRt": -1, 6 | "maxThread": 10 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/system.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "highestSystemLoad": -1, 4 | "qps": 100, 5 | "avgRt": -1, 6 | "maxThread": 10 7 | } 8 | ] 9 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18033 2 | spring.cloud.alicloud.scx.group-id=*** 3 | spring.cloud.alicloud.edas.namespace=cn-test 4 | -------------------------------------------------------------------------------- /spring-cloud-stream-binder-rocketmq/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.stream.binder.rocketmq.config.RocketMQComponent4BinderAutoConfiguration 3 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-config-server/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # Auto-Configuration 2 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 3 | com.alibaba.cloud.nacos.config.server.NacosConfigServerAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/scripts/error.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | n=1 3 | while [ $n -le 10 ] 4 | do 5 | echo `curl -s http://localhost:18083/test` 6 | let n++ 7 | done 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/scripts/index.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | n=1 3 | while [ $n -le 10 ] 4 | do 5 | echo `curl -s http://localhost:18083/index` 6 | let n++ 7 | done 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/scripts/sleep.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | n=1 3 | while [ $n -le 10 ] 4 | do 5 | echo `curl -s http://localhost:18083/sleep` 6 | let n++ 7 | done 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=ans-provider 2 | server.port=18081 3 | spring.cloud.alicloud.ans.server-list=127.0.0.1 4 | spring.cloud.alicloud.ans.server-port=8080 -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/test/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "resource", 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-schedulerx/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.alicloud.scx.endpoint.ScxEndpointAutoConfiguration,\ 3 | com.alibaba.alicloud.scx.ScxAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.alicloud.sms.config.SmsAutoConfiguration,\ 3 | com.alibaba.alicloud.sms.endpoint.SmsEndpointAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-bus-rocketmq/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | # EnvironmentPostProcessor 2 | org.springframework.boot.env.EnvironmentPostProcessor=\ 3 | com.alibaba.cloud.bus.rocketmq.env.RocketMQBusEnvironmentPostProcessor -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/test/resources/flowrule-errorcontent.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "test": 1, 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | } 10 | ] 11 | 12 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/scripts/feign-error.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | n=1 3 | while [ $n -le 10 ] 4 | do 5 | echo `curl -s http://localhost:18083/divide-feign?a=1\&b=0` 6 | let n++ 7 | done 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/test/resources/flowrule-errorformat.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "resource", 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | }== 10 | ] 11 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/scripts/feign-defaultmethod-error.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | n=1 3 | while [ $n -le 10 ] 4 | do 5 | echo `curl -s http://localhost:18083/divide-feign2?a=1` 6 | let n++ 7 | done 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/acm-example/acm-local-example/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=acm-local 2 | server.port=18089 3 | spring.cloud.alicloud.acm.server-list=127.0.0.1 4 | spring.cloud.alicloud.acm.server-port=8080 5 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/account-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=account-service 2 | server.port=18084 3 | 4 | mysql.server.ip=127.0.0.1 5 | mysql.server.port=3306 6 | mysql.db.name=demo 7 | 8 | mysql.user.name=root 9 | mysql.user.password=123456 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/order-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=order-service 2 | server.port=18083 3 | 4 | mysql.server.ip=127.0.0.1 5 | mysql.server.port=3306 6 | mysql.db.name=demo 7 | 8 | mysql.user.name=root 9 | mysql.user.password=123456 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/storage-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=storage-service 2 | server.port=18082 3 | 4 | mysql.server.ip=127.0.0.1 5 | mysql.server.port=3306 6 | mysql.db.name=demo 7 | 8 | mysql.user.name=root 9 | mysql.user.password=123456 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-provider-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18082 2 | spring.application.name=service-provider 3 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 4 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18086 2 | spring.application.name=service-gateway-provider 3 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 4 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-bus-rocketmq-example/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=spring-cloud-bus-rocketmq-example 2 | spring.cloud.stream.rocketmq.binder.name-server=127.0.0.1:9876 3 | server.port=8080 4 | spring.cloud.bus.id=${spring.application.name}:${server.port} -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=feign-consumer 2 | server.port=18083 3 | # The following configuration can be omitted. 4 | spring.cloud.alicloud.ans.server-list=127.0.0.1 5 | spring.cloud.alicloud.ans.server-port=8080 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=ribbon-consumer 2 | server.port=18082 3 | # The following configuration can be omitted. 4 | spring.cloud.alicloud.ans.server-list=127.0.0.1 5 | spring.cloud.alicloud.ans.server-port=8080 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/business-service/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18081 2 | spring.application.name=business-service 3 | # The following configuration can be omitted. 4 | 5 | #feign.hystrix.enabled=true 6 | #feign.sentinel.enabled=true 7 | 8 | logging.level.io.seata=debug -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/src/main/java/com/alibaba/cloud/examples/FooService.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | /** 4 | * @author fangjian 5 | */ 6 | public interface FooService { 7 | 8 | String hello(String name); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/oss-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=oss-example 2 | server.port=18084 3 | spring.cloud.alicloud.access-key=AK 4 | spring.cloud.alicloud.secret-key=SK 5 | spring.cloud.alicloud.oss.endpoint=***.aliyuncs.com 6 | management.endpoints.web.exposure.include=* 7 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "GET:http://service-provider/echo/{str}", 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | } 10 | ] 11 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-config-example/src/main/resources/bootstrap.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=nacos-config-example 2 | spring.cloud.nacos.config.server-addr=127.0.0.1:8848 3 | spring.cloud.nacos.config.shared-data-ids=base-common.properties,common.properties 4 | spring.cloud.nacos.config.refreshable-dataids=common.properties -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/test/resources/degraderule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "abc0", 4 | "count": 20.0, 5 | "grade": 0, 6 | "passCount": 0, 7 | "timeWindow": 10 8 | }, 9 | { 10 | "resource": "abc1", 11 | "count": 15.0, 12 | "grade": 0, 13 | "passCount": 0, 14 | "timeWindow": 10 15 | } 16 | ] -------------------------------------------------------------------------------- /spring-cloud-alicloud-oss/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.alicloud.oss.OssAutoConfiguration,\ 3 | com.alibaba.alicloud.oss.endpoint.OssEndpointAutoConfiguration 4 | org.springframework.context.ApplicationListener=\ 5 | com.alibaba.alicloud.oss.OssApplicationListener -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-gateway/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.sentinel.gateway.zuul.SentinelZuulAutoConfiguration,\ 3 | com.alibaba.cloud.sentinel.gateway.scg.SentinelSCGAutoConfiguration,\ 4 | com.alibaba.cloud.sentinel.gateway.SentinelGatewayAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/test/resources/authority.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "good", 4 | "limitApp": "abc", 5 | "strategy": 0 6 | }, 7 | { 8 | "resource": "bad", 9 | "limitApp": "bcd", 10 | "strategy": 1 11 | }, 12 | { 13 | "resource": "terrible", 14 | "limitApp": "aaa", 15 | "strategy": 1 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/test/resources/param-flow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "hotResource", 4 | "count": 0, 5 | "grade": 1, 6 | "limitApp": "default", 7 | "paramIdx": 0, 8 | "paramFlowItemList": [ 9 | { 10 | "object": "2", 11 | "classType": "int", 12 | "count": 1 13 | } 14 | ] 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-acm/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.cloud.bootstrap.BootstrapConfiguration=\ 2 | com.alibaba.alicloud.acm.bootstrap.AcmPropertySourceLocator 3 | 4 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 5 | com.alibaba.alicloud.acm.AcmAutoConfiguration,\ 6 | com.alibaba.alicloud.acm.endpoint.AcmEndpointAutoConfiguration -------------------------------------------------------------------------------- /PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 2 | ### Describe what this PR does / why we need it 3 | 4 | 5 | ### Does this pull request fix one issue? 6 | 7 | 8 | 9 | ### Describe how you did it 10 | 11 | 12 | ### Describe how to verify it 13 | 14 | 15 | ### Special notes for reviews 16 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: client 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: localhost:8848 8 | config: 9 | discovery: 10 | enabled: true 11 | profiles: 12 | active: dev -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.alicloud.ans.endpoint.AnsEndpointAutoConfiguration,\ 3 | com.alibaba.alicloud.ans.ribbon.RibbonAnsAutoConfiguration,\ 4 | com.alibaba.alicloud.ans.AnsAutoConfiguration,\ 5 | com.alibaba.alicloud.ans.AnsDiscoveryClientAutoConfiguration -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/degraderule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "abc0", 4 | "count": 20.0, 5 | "grade": 0, 6 | "passCount": 0, 7 | "timeWindow": 10 8 | }, 9 | { 10 | "resource": "abc1", 11 | "count": 15.0, 12 | "grade": 0, 13 | "passCount": 0, 14 | "timeWindow": 10 15 | } 16 | ] -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/authority.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "good", 4 | "limitApp": "abc", 5 | "strategy": 0 6 | }, 7 | { 8 | "resource": "bad", 9 | "limitApp": "bcd", 10 | "strategy": 1 11 | }, 12 | { 13 | "resource": "terrible", 14 | "limitApp": "aaa", 15 | "strategy": 1 16 | } 17 | ] 18 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/param-flow.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "aa", 4 | "count": 0, 5 | "grade": 1, 6 | "limitApp": "default", 7 | "paramIdx": 0, 8 | "paramFlowItemList": [ 9 | { 10 | "object": "2", 11 | "classType": "int", 12 | "count": 1 13 | } 14 | ] 15 | } 16 | ] 17 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sms-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=sca-sms-example 2 | server.port=9051 3 | # config sms 4 | spring.cloud.alicloud.access-key=***** 5 | spring.cloud.alicloud.secret-key=****** 6 | spring.cloud.alicloud.sms.report-queue-name=***** 7 | spring.cloud.alicloud.sms.up-queue-name=***** 8 | #config endpoint 9 | management.endpoints.web.exposure.include=* -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/custom/SentinelCircuitBreakerConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.sentinel.custom; 2 | 3 | import org.springframework.context.annotation.Configuration; 4 | 5 | /** 6 | * @author lengleng 7 | *

8 | * support @EnableCircuitBreaker ,Do nothing 9 | */ 10 | @Configuration 11 | public class SentinelCircuitBreakerConfiguration { 12 | } 13 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name = dubbo-consumer-demo 2 | 3 | foo.service.version = 1.0.0 4 | 5 | dubbo.application.id = dubbo-consumer-demo 6 | dubbo.application.name = dubbo-consumer-demo 7 | 8 | dubbo.protocol.id = dubbo 9 | dubbo.protocol.name = dubbo 10 | dubbo.protocol.port = 12345 11 | 12 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/test/resources/application.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | scan: 3 | base-packages: com.alibaba.cloud.dubbo.service 4 | protocols: 5 | dubbo: 6 | name: dubbo 7 | port: 12345 8 | rest: 9 | name: rest 10 | port: 8081 11 | server: netty 12 | registry: 13 | address: spring-cloud://nacos 14 | 15 | feign: 16 | hystrix: 17 | enabled: true 18 | 19 | server: 20 | port: 8080 -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/main/resources/META-INF/sentinel-datasource.properties: -------------------------------------------------------------------------------- 1 | nacos = com.alibaba.csp.sentinel.datasource.nacos.NacosDataSource 2 | file =com.alibaba.csp.sentinel.datasource.FileRefreshableDataSource 3 | apollo = com.alibaba.csp.sentinel.datasource.apollo.ApolloDataSource 4 | zk = com.alibaba.csp.sentinel.datasource.zookeeper.ZookeeperDataSource 5 | redis = com.alibaba.csp.sentinel.datasource.redis.RedisDataSource -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "/mono", 4 | "controlBehavior": 0, 5 | "count": 0, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | }, 10 | { 11 | "resource": "/flux", 12 | "controlBehavior": 0, 13 | "count": 0, 14 | "grade": 1, 15 | "limitApp": "default", 16 | "strategy": 0 17 | } 18 | ] 19 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-servlet-gateway-sample/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | registry: 3 | # The Spring Cloud Dubbo's registry extension 4 | address: spring-cloud://localhost 5 | # The traditional Dubbo's registry 6 | # address: zookeeper://127.0.0.1:2181 7 | server: 8 | port: 0 9 | 10 | provider: 11 | application: 12 | name: spring-cloud-alibaba-dubbo-web-provider -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 7070 3 | 4 | spring: 5 | application: 6 | name: configserver 7 | cloud: 8 | nacos: 9 | discovery: 10 | server-addr: localhost:8848 11 | config: 12 | server: 13 | git: 14 | uri: https://github.com/fangjian0423/blogimages 15 | search-paths: / 16 | 17 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.seata.rest.SeataRestTemplateAutoConfiguration,\ 3 | com.alibaba.cloud.seata.web.SeataHandlerInterceptorConfiguration,\ 4 | com.alibaba.cloud.seata.GlobalTransactionAutoConfiguration,\ 5 | com.alibaba.cloud.seata.feign.SeataFeignClientAutoConfiguration,\ 6 | com.alibaba.cloud.seata.feign.hystrix.SeataHystrixAutoConfiguration 7 | 8 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/resources/META-INF/dubbo/default/actuator-endpoints.properties: -------------------------------------------------------------------------------- 1 | # Dubbo Endpoints Default Properties is loaded by @PropertySource with low order, 2 | # Set enabled for Dubbo Endpoints 3 | management.endpoint.dubborestmetadata.enabled = true 4 | 5 | # "management.endpoints.web.base-path" should not be configured in this file 6 | # Re-defines path-mapping of Dubbo Web Endpoints 7 | management.endpoints.web.path-mapping.dubborestmetadata = dubbo/rest/metadata -------------------------------------------------------------------------------- /spring-cloud-alicloud-acm/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "spring.application.group", 5 | "type": "java.lang.String", 6 | "description": "spring application group." 7 | }, 8 | { 9 | "name": "spring.cloud.alicloud.acm.enabled", 10 | "type": "java.lang.Boolean", 11 | "defaultValue": true, 12 | "description": "enable acm or not." 13 | } 14 | ] 15 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-client-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | registry: 3 | address: spring-cloud://localhost 4 | cloud: 5 | subscribed-services: spring-cloud-alibaba-dubbo-server 6 | 7 | spring: 8 | application: 9 | name: spring-cloud-alibaba-dubbo-client 10 | main: 11 | allow-bean-definition-overriding: true 12 | cloud: 13 | nacos: 14 | discovery: 15 | server-addr: 127.0.0.1:8848 -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-config/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.cloud.bootstrap.BootstrapConfiguration=\ 2 | com.alibaba.cloud.nacos.NacosConfigBootstrapConfiguration 3 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 4 | com.alibaba.cloud.nacos.NacosConfigAutoConfiguration,\ 5 | com.alibaba.cloud.nacos.endpoint.NacosConfigEndpointAutoConfiguration 6 | org.springframework.boot.diagnostics.FailureAnalyzer=\ 7 | com.alibaba.cloud.nacos.diagnostics.analyzer.NacosConnectionFailureAnalyzer -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=sentinel-webflux-example 2 | server.port=18084 3 | management.endpoints.web.exposure.include=* 4 | spring.cloud.sentinel.transport.dashboard=localhost:8080 5 | spring.cloud.sentinel.eager=true 6 | 7 | 8 | spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json 9 | spring.cloud.sentinel.datasource.ds1.file.data-type=json 10 | spring.cloud.sentinel.datasource.ds1.file.rule-type=flow -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Compiled class file 2 | *.class 3 | *.classpath 4 | *.factorypath 5 | 6 | # Log file 7 | *.log 8 | 9 | # BlueJ files 10 | *.ctxt 11 | 12 | # Mobile Tools for Java (J2ME) 13 | .mtj.tmp/ 14 | 15 | # Package Files # 16 | *.jar 17 | *.war 18 | *.ear 19 | *.zip 20 | *.tar.gz 21 | *.rar 22 | 23 | # virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml 24 | hs_err_pid* 25 | 26 | # IDE Files # 27 | *.iml 28 | .idea 29 | .idea/ 30 | .project 31 | .settings 32 | target 33 | .DS_Store 34 | 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/readme-zh.md: -------------------------------------------------------------------------------- 1 | # ANS Consumer Feign Example 2 | 3 | ## 项目说明 4 | 5 | 本项目展示了,在Spring Cloud规范下,如何以最简单且免费的方式,使用Feign客户端,调用一个服务。 6 | 7 | ## 示例 8 | 9 | ### 准备工作 10 | 11 | ans-provider-example已经成功启动,并发布服务成功。 12 | 13 | ### 启动应用 14 | 15 | 直接运行main class,即`ConsumerApplication`。 16 | 17 | ### 查看效果 18 | 19 | 使用`curl`命令可以看到应用打印出相应的调用日志,命令如下。 20 | 21 | curl http://127.0.0.1:18082/ 22 | 23 | 24 | 如果您对 Spring Cloud ANS Starter 有任何建议或想法,欢迎提交 issue 中或者通过其他社区渠道向我们反馈。 25 | 26 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/readme-zh.md: -------------------------------------------------------------------------------- 1 | # ANS Consumer Ribbon Example 2 | 3 | ## 项目说明 4 | 5 | 本项目展示了,在Spring Cloud规范下,如何以最简单且免费的方式,使用Ribbon客户端,调用一个服务。 6 | 7 | ## 示例 8 | 9 | ### 准备工作 10 | 11 | ans-provider-example已经成功启动,并发布服务成功。 12 | 13 | ### 启动应用 14 | 15 | 直接运行main class,即`ConsumerApplication`。 16 | 17 | ### 查看效果 18 | 19 | 使用`curl`命令可以看到应用打印出相应的调用日志,命令如下。 20 | 21 | curl http://127.0.0.1:18082/ 22 | 23 | 24 | 如果您对 Spring Cloud ANS Starter 有任何建议或想法,欢迎提交 issue 中或者通过其他社区渠道向我们反馈。 25 | 26 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-server-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | scan: 3 | base-packages: com.alibaba.cloud.dubbo.bootstrap 4 | protocol: 5 | name: dubbo 6 | port: -1 7 | registry: 8 | address: spring-cloud://localhost 9 | 10 | spring: 11 | application: 12 | name: spring-cloud-alibaba-dubbo-server 13 | main: 14 | allow-bean-definition-overriding: true 15 | cloud: 16 | nacos: 17 | discovery: 18 | server-addr: 127.0.0.1:8848 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/resources/gateway.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "some_customized_api", 4 | "count": 1 5 | }, 6 | { 7 | "resource": "httpbin_route", 8 | "count": 0, 9 | "paramItem": { 10 | "parseStrategy": 2, 11 | "fieldName": "Spring-Cloud-Alibaba" 12 | } 13 | }, 14 | { 15 | "resource": "httpbin_route", 16 | "count": 0, 17 | "paramItem": { 18 | "parseStrategy": 3, 19 | "fieldName": "name" 20 | } 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name = dubbo-provider-demo 2 | 3 | foo.service.version = 1.0.0 4 | 5 | dubbo.scan.basePackages = com.alibaba.cloud.examples 6 | 7 | dubbo.application.id = dubbo-provider-demo 8 | dubbo.application.name = dubbo-provider-demo 9 | 10 | dubbo.protocol.id = dubbo 11 | dubbo.protocol.name = dubbo 12 | dubbo.protocol.port = 12345 13 | dubbo.protocol.status = server 14 | 15 | dubbo.registry.id = my-registry 16 | dubbo.registry.address = N/A 17 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "properties": [ 3 | { 4 | "name": "spring.cloud.alicloud.ans.client-domains", 5 | "type": "java.lang.String", 6 | "defaultValue": "", 7 | "description": "Service name list, default value is ${spring.application.name}." 8 | }, 9 | { 10 | "name": "spring.cloud.alicloud.ans.env", 11 | "type": "java.lang.String", 12 | "defaultValue": "DEFAULT", 13 | "description": "The env for ans, default value is DEFAULT." 14 | } 15 | ] 16 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/test/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "resource", 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | }, 10 | { 11 | "resource": "p", 12 | "controlBehavior": 0, 13 | "count": 1, 14 | "grade": 1, 15 | "limitApp": "default", 16 | "strategy": 0 17 | }, 18 | { 19 | "resource": "http://www.taobao.com", 20 | "controlBehavior": 0, 21 | "count": 0, 22 | "grade": 1, 23 | "limitApp": "default", 24 | "strategy": 0 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | scan: 3 | base-packages: com.alibaba.cloud.dubbo.service 4 | protocols: 5 | dubbo: 6 | name: dubbo 7 | port: -1 8 | rest: 9 | name: rest 10 | port: 9090 11 | server: netty 12 | registry: 13 | # The Spring Cloud Dubbo's registry extension 14 | address: spring-cloud://localhost 15 | # The traditional Dubbo's registry 16 | # address: zookeeper://127.0.0.1:2181 17 | feign: 18 | hystrix: 19 | enabled: true -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: how to ask an valid question 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 11 | We recommend using English. If you are non-native English speaker, you can use the translation software. 12 | 13 | 14 | **Which Component** 15 | eg. Nacos Discovery, Sentinel 16 | 17 | **Describe what problem you have encountered** 18 | A clear and concise description of what you want to do. 19 | 20 | **Describe what information you have read** 21 | eg. I have read the reference doc of Sentinel 22 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/FooServiceImpl.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.apache.dubbo.config.annotation.Service; 4 | 5 | /** 6 | * @author fangjian 7 | */ 8 | @Service(version = "${foo.service.version}", application = "${dubbo.application.id}", protocol = "${dubbo.protocol.id}", registry = "${dubbo.registry.id}") 9 | public class FooServiceImpl implements FooService { 10 | 11 | @Override 12 | public String hello(String name) { 13 | return "hello, " + name; 14 | } 15 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/gateway.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "some_customized_api", 4 | "count": 0 5 | }, 6 | { 7 | "resource": "my-service2", 8 | "count": 0 9 | }, 10 | { 11 | "resource": "my-service3", 12 | "count": 0, 13 | "paramItem": { 14 | "parseStrategy": 2, 15 | "fieldName": "Spring-Cloud-Alibaba" 16 | } 17 | }, 18 | { 19 | "resource": "my-service4", 20 | "count": 0, 21 | "paramItem": { 22 | "parseStrategy": 3, 23 | "fieldName": "name" 24 | } 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.sentinel.SentinelWebAutoConfiguration,\ 3 | com.alibaba.cloud.sentinel.SentinelWebFluxAutoConfiguration,\ 4 | com.alibaba.cloud.sentinel.endpoint.SentinelEndpointAutoConfiguration,\ 5 | com.alibaba.cloud.sentinel.custom.SentinelAutoConfiguration,\ 6 | com.alibaba.cloud.sentinel.feign.SentinelFeignAutoConfiguration 7 | 8 | org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker=\ 9 | com.alibaba.cloud.sentinel.custom.SentinelCircuitBreakerConfiguration 10 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-consumer-example/src/main/java/com/alibaba/cloud/examples/FooServiceConsumer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.apache.dubbo.config.annotation.Reference; 4 | 5 | /** 6 | * @author fangjian 7 | */ 8 | public class FooServiceConsumer { 9 | 10 | @Reference(version = "${foo.service.version}", application = "${dubbo.application.id}", url = "dubbo://localhost:12345", timeout = 30000) 11 | private FooService fooService; 12 | 13 | public String hello(String name) { 14 | return fooService.hello(name); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sms-example/src/main/java/com/alibaba/cloud/example/SmsUpMessageListener.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.example; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | import com.aliyun.mns.model.Message; 6 | 7 | /** 8 | * @author 如果发送的短信需要接收对方回复的状态消息,只需实现该接口并初始化一个 Spring Bean 即可。 9 | */ 10 | @Component 11 | public class SmsUpMessageListener 12 | implements com.alibaba.alicloud.sms.SmsUpMessageListener { 13 | 14 | @Override 15 | public boolean dealMessage(Message message) { 16 | System.err.println(this.getClass().getName() + "; " + message.toString()); 17 | return true; 18 | } 19 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/ribbon/ExtendBalancer.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.nacos.ribbon; 2 | 3 | import java.util.List; 4 | 5 | import com.alibaba.nacos.api.naming.pojo.Instance; 6 | import com.alibaba.nacos.client.naming.core.Balancer; 7 | 8 | /** 9 | * @author itmuch.com 10 | */ 11 | public class ExtendBalancer extends Balancer { 12 | /** 13 | * 根据权重,随机选择实例 14 | * 15 | * @param instances 实例列表 16 | * @return 选择的实例 17 | */ 18 | public static Instance getHostByRandomWeight2(List instances) { 19 | return getHostByRandomWeight(instances); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | server.port=18085 2 | spring.application.name=service-gateway 3 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 4 | management.endpoints.web.exposure.include=* 5 | 6 | # spring cloud route config 7 | spring.cloud.gateway.routes[0].id=nacos-route 8 | spring.cloud.gateway.routes[0].uri=lb://service-gateway-provider 9 | spring.cloud.gateway.routes[0].predicates[0].name=Path 10 | spring.cloud.gateway.routes[0].predicates[0].args[pattern]=/nacos/** 11 | spring.cloud.gateway.routes[0].filters[0]=StripPrefix=1 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "/hello", 4 | "controlBehavior": 0, 5 | "count": 1, 6 | "grade": 1, 7 | "limitApp": "default", 8 | "strategy": 0 9 | }, 10 | { 11 | "resource": "/test", 12 | "controlBehavior": 0, 13 | "count": 0, 14 | "grade": 1, 15 | "limitApp": "default", 16 | "strategy": 0 17 | }, 18 | { 19 | "resource": "GET:http://www.taobao.com", 20 | "controlBehavior": 0, 21 | "count": 0, 22 | "grade": 1, 23 | "limitApp": "default", 24 | "strategy": 0 25 | } 26 | ] 27 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-discovery-example/src/main/java/com/alibaba/cloud/examples/GatewayApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | /** 8 | * @author lengleng 9 | */ 10 | @SpringBootApplication 11 | @EnableDiscoveryClient 12 | public class GatewayApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(GatewayApplication.class, args); 16 | } 17 | 18 | } 19 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/test/resources/flowrule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | resource 5 | 0 6 | 1 7 | 1 8 | default 9 | 0 10 | 11 | 12 | test 13 | 0 14 | 1 15 | 1 16 | default 17 | 0 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.nacos.NacosDiscoveryAutoConfiguration,\ 3 | com.alibaba.cloud.nacos.ribbon.RibbonNacosAutoConfiguration,\ 4 | com.alibaba.cloud.nacos.endpoint.NacosDiscoveryEndpointAutoConfiguration,\ 5 | com.alibaba.cloud.nacos.discovery.NacosDiscoveryClientAutoConfiguration,\ 6 | com.alibaba.cloud.nacos.discovery.configclient.NacosConfigServerAutoConfiguration 7 | org.springframework.cloud.bootstrap.BootstrapConfiguration=\ 8 | com.alibaba.cloud.nacos.discovery.configclient.NacosDiscoveryClientConfigServiceBootstrapConfiguration 9 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/degraderule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "GET:http://service-provider/test", 4 | "count": 0.5, 5 | "grade": 1, 6 | "timeWindow": 30 7 | }, 8 | { 9 | "resource": "GET:http://service-provider", 10 | "count": 0.5, 11 | "grade": 1, 12 | "timeWindow": 10 13 | }, 14 | { 15 | "resource": "GET:http://service-provider/sleep", 16 | "count": 20.0, 17 | "grade": 0, 18 | "timeWindow": 30 19 | }, 20 | { 21 | "resource": "GET:http://service-provider/divide", 22 | "count": 0.5, 23 | "grade": 1, 24 | "timeWindow": 30 25 | } 26 | ] -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/flowrule.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | resource 5 | 0 6 | 1 7 | 1 8 | default 9 | 0 10 | 11 | 12 | test 13 | 0 14 | 1 15 | 1 16 | default 17 | 0 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/JsonFlowRuleListConverter.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import java.util.List; 4 | 5 | import com.alibaba.csp.sentinel.datasource.Converter; 6 | import com.alibaba.csp.sentinel.slots.block.flow.FlowRule; 7 | import com.alibaba.fastjson.JSON; 8 | import com.alibaba.fastjson.TypeReference; 9 | 10 | /** 11 | * @author fangjian 12 | */ 13 | public class JsonFlowRuleListConverter implements Converter> { 14 | @Override 15 | public List convert(String source) { 16 | return JSON.parseObject(source, new TypeReference>() { 17 | }); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-docs/src/main/asciidoc/spring-cloud-alibaba.adoc: -------------------------------------------------------------------------------- 1 | [[spring-cloud-alibaba-reference]] 2 | = Spring Cloud Alibaba Reference Documentation 3 | Jim Fang, Jing Xiao, Mercy Ma, Xiaolong Zuo, Bingting Peng, Yuxin Wang 4 | :doctype: book 5 | :toc: 6 | :toclevels: 4 7 | :source-highlighter: prettify 8 | :numbered: 9 | 10 | include::introduction.adoc[] 11 | 12 | include::dependency-management.adoc[] 13 | 14 | include::nacos-discovery.adoc[] 15 | 16 | include::nacos-config.adoc[] 17 | 18 | include::sentinel.adoc[] 19 | 20 | include::dubbo.adoc[] 21 | 22 | include::rocketmq.adoc[] 23 | 24 | include::ans.adoc[] 25 | 26 | include::acm.adoc[] 27 | 28 | include::oss.adoc[] 29 | 30 | include::schedulerx.adoc[] 31 | 32 | include::sms.adoc[] -------------------------------------------------------------------------------- /spring-cloud-alibaba-docs/src/main/asciidoc-zh/spring-cloud-alibaba.adoc: -------------------------------------------------------------------------------- 1 | [[spring-cloud-alibaba-reference]] 2 | = Spring Cloud Alibaba 参考文档 3 | Jim Fang, Jing Xiao, Mercy Ma, Xiaolong Zuo, Bingting Peng, Yuxin Wang 4 | :doctype: book 5 | :toc: 6 | :toclevels: 4 7 | :source-highlighter: prettify 8 | :numbered: 9 | 10 | include::introduction.adoc[] 11 | 12 | include::dependency-management.adoc[] 13 | 14 | include::nacos-discovery.adoc[] 15 | 16 | include::nacos-config.adoc[] 17 | 18 | include::sentinel.adoc[] 19 | 20 | include::dubbo.adoc[] 21 | 22 | include::rocketmq.adoc[] 23 | 24 | include::ans.adoc[] 25 | 26 | include::acm.adoc[] 27 | 28 | include::oss.adoc[] 29 | 30 | include::schedulerx.adoc[] 31 | 32 | include::sms.adoc[] 33 | 34 | 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/api.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "apiName": "some_customized_api", 4 | "predicateItems": [ 5 | { 6 | "pattern": "/product/baz" 7 | }, 8 | { 9 | "pattern": "/product/foo/**", 10 | "matchStrategy": 1 11 | }, 12 | { 13 | "items": [ 14 | { 15 | "pattern": "/spring-cloud/**" 16 | }, 17 | { 18 | "pattern": "/spring-cloud-alibaba/**" 19 | } 20 | ] 21 | } 22 | ] 23 | }, 24 | { 25 | "apiName": "another_customized_api", 26 | "predicateItems": [ 27 | { 28 | "pattern": "/ahas" 29 | } 30 | ] 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | scan: 3 | base-packages: com.alibaba.cloud.dubbo.service 4 | protocols: 5 | dubbo: 6 | name: dubbo 7 | port: -1 8 | registries: 9 | new: 10 | address: spring-cloud://localhost 11 | # registry: 12 | # The Spring Cloud Dubbo's registry extension 13 | # address: spring-cloud://localhost 14 | # The traditional Dubbo's registry 15 | # address: nacos://127.0.0.1:8848 16 | 17 | feign: 18 | hystrix: 19 | enabled: true 20 | 21 | server: 22 | port: 8080 23 | 24 | management: 25 | endpoints: 26 | web: 27 | exposure: 28 | include: dubborestmetadata -------------------------------------------------------------------------------- /spring-cloud-alibaba-docs/src/main/asciidoc-zh/dependency-management.adoc: -------------------------------------------------------------------------------- 1 | == 依赖管理 2 | 3 | Spring Cloud Alibaba BOM 包含了它所使用的所有依赖的版本。 4 | 5 | 如果您是 Maven Central 用户,请将我们的 BOM 添加到您的 pom.xml 中的 部分。 这将允许您省略任何Maven依赖项的版本,而是将版本控制委派给BOM。 6 | 7 | ```xml 8 | 9 | 10 | 11 | com.alibaba.cloud 12 | spring-cloud-alibaba-dependencies 13 | 2.1.1.BUILD-SNAPSHOT 14 | pom 15 | import 16 | 17 | 18 | 19 | ``` 20 | 21 | 在下面的章节中,假设您使用的是 Spring Cloud Alibaba bom,相关 starter 依赖将不包含版本号。 22 | 23 | 24 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/resources/api.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "apiName": "some_customized_api", 4 | "predicateItems": [ 5 | { 6 | "pattern": "/product/baz" 7 | }, 8 | { 9 | "pattern": "/product/foo/**", 10 | "matchStrategy": 1 11 | }, 12 | { 13 | "items": [ 14 | { 15 | "pattern": "/spring-cloud/**" 16 | }, 17 | { 18 | "pattern": "/spring-cloud-alibaba/**" 19 | } 20 | ] 21 | } 22 | ] 23 | }, 24 | { 25 | "apiName": "another_customized_api", 26 | "predicateItems": [ 27 | { 28 | "pattern": "/ahas" 29 | } 30 | ] 31 | } 32 | ] 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | dubbo: 2 | registry: 3 | # The Spring Cloud Dubbo's registry extension 4 | ## the default value of dubbo-provider-services is "*", that means to subscribe all providers, 5 | ## thus it's optimized if subscriber specifies the required providers. 6 | address: spring-cloud://localhost 7 | # The traditional Dubbo's registry also is supported 8 | # address: zookeeper://127.0.0.1:2181 9 | cloud: 10 | # The subscribed services in consumer side 11 | subscribed-services: ${provider.application.name} 12 | 13 | server: 14 | port: 0 15 | 16 | provider: 17 | application: 18 | name: spring-cloud-alibaba-dubbo-provider -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-provider-example/src/main/java/com/alibaba/cloud/examples/SentinelDubboProviderApp.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.boot.WebApplicationType; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.boot.builder.SpringApplicationBuilder; 6 | 7 | /** 8 | * @author fangjian 9 | */ 10 | @SpringBootApplication 11 | public class SentinelDubboProviderApp { 12 | 13 | public static void main(String[] args) { 14 | SpringApplicationBuilder providerBuilder = new SpringApplicationBuilder(); 15 | providerBuilder.web(WebApplicationType.NONE) 16 | .sources(SentinelDubboProviderApp.class).run(args); 17 | } 18 | 19 | } 20 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.http.HttpRequest; 4 | import org.springframework.http.client.ClientHttpRequestExecution; 5 | 6 | import com.alibaba.cloud.sentinel.rest.SentinelClientHttpResponse; 7 | import com.alibaba.csp.sentinel.slots.block.BlockException; 8 | 9 | /** 10 | * @author fangjian 11 | */ 12 | public class ExceptionUtil { 13 | 14 | public static SentinelClientHttpResponse handleException(HttpRequest request, 15 | byte[] body, ClientHttpRequestExecution execution, BlockException ex) { 16 | System.out.println("Oops: " + ex.getClass().getCanonicalName()); 17 | return new SentinelClientHttpResponse("custom block info"); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/Foo.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | /** 4 | * @author Jim 5 | */ 6 | public class Foo { 7 | 8 | private int id; 9 | private String bar; 10 | 11 | public Foo() { 12 | } 13 | 14 | public Foo(int id, String bar) { 15 | this.id = id; 16 | this.bar = bar; 17 | } 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public String getBar() { 28 | return bar; 29 | } 30 | 31 | public void setBar(String bar) { 32 | this.bar = bar; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Foo{" + "id=" + id + ", bar='" + bar + '\'' + '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/java/com/alibaba/cloud/examples/Foo.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | /** 4 | * @author Jim 5 | */ 6 | public class Foo { 7 | 8 | private int id; 9 | private String bar; 10 | 11 | public Foo() { 12 | } 13 | 14 | public Foo(int id, String bar) { 15 | this.id = id; 16 | this.bar = bar; 17 | } 18 | 19 | public int getId() { 20 | return id; 21 | } 22 | 23 | public void setId(int id) { 24 | this.id = id; 25 | } 26 | 27 | public String getBar() { 28 | return bar; 29 | } 30 | 31 | public void setBar(String bar) { 32 | this.bar = bar; 33 | } 34 | 35 | @Override 36 | public String toString() { 37 | return "Foo{" + "id=" + id + ", bar='" + bar + '\'' + '}'; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/sms/SmsContextAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.alicloud.context.sms; 2 | 3 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 5 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 6 | import org.springframework.context.annotation.Configuration; 7 | 8 | /** 9 | * @author pbting 10 | * @author xiaolongzuo 11 | */ 12 | @Configuration 13 | @EnableConfigurationProperties(SmsProperties.class) 14 | @ConditionalOnClass(name = "com.aliyuncs.dysmsapi.model.v20170525.SendSmsRequest") 15 | @ConditionalOnProperty(name = "spring.cloud.alicloud.sms.enabled", matchIfMissing = true) 16 | public class SmsContextAutoConfiguration { 17 | 18 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-consumer-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=service-consumer 2 | server.port=18083 3 | management.endpoints.web.exposure.include=* 4 | spring.cloud.nacos.discovery.server-addr=127.0.0.1:8848 5 | 6 | feign.sentinel.enabled=true 7 | 8 | spring.cloud.sentinel.transport.dashboard=localhost:8080 9 | spring.cloud.sentinel.eager=true 10 | 11 | spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json 12 | spring.cloud.sentinel.datasource.ds1.file.data-type=json 13 | spring.cloud.sentinel.datasource.ds1.file.rule-type=flow 14 | 15 | spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json 16 | spring.cloud.sentinel.datasource.ds2.file.data-type=json 17 | spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade -------------------------------------------------------------------------------- /spring-cloud-alibaba-docs/src/main/asciidoc/dependency-management.adoc: -------------------------------------------------------------------------------- 1 | == Dependency Management 2 | 3 | If you’re a Maven Central user, add our BOM to your pom.xml section. This will allow you to omit versions for any of the Maven dependencies and instead delegate versioning to the BOM. 4 | 5 | ```xml 6 | 7 | 8 | 9 | com.alibaba.cloud 10 | spring-cloud-alibaba-dependencies 11 | 2.1.1.BUILD-SNAPSHOT 12 | pom 13 | import 14 | 15 | 16 | 17 | ``` 18 | 19 | In the following sections, it will be assumed you are using the Spring Cloud Alibaba BOM and the dependency snippets will not contain versions. 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-alibaba-seata/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alibaba-seata 11 | Spring Cloud Starter Alibaba Seata 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alibaba-seata 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/alicloud/acm/AcmAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.acm; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class AcmAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/alicloud/ans/AnsAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class AnsAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/alicloud/oss/OssAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.oss; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class OssAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/alicloud/scx/ScxAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.scx; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class ScxAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/spring-cloud-starter-alicloud-acm/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alicloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alicloud-acm 11 | Spring Cloud Starter Alibaba Cloud ACM 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alicloud-acm 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/spring-cloud-starter-alicloud-sms/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alicloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alicloud-sms 11 | Spring Cloud Starter Alibaba Cloud SMS 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alicloud-sms 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/SmsUpMessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms; 17 | 18 | /** 19 | * @author pbting 20 | */ 21 | public interface SmsUpMessageListener extends SmsMessageListener { 22 | } -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-alibaba-sentinel/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alibaba-sentinel 11 | Spring Cloud Starter Alibaba Sentinel 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alibaba-sentinel 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sms-example/src/main/java/com/alibaba/cloud/example/SmsReportMessageListener.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.example; 2 | 3 | import java.util.LinkedList; 4 | import java.util.List; 5 | 6 | import org.springframework.stereotype.Component; 7 | 8 | import com.aliyun.mns.model.Message; 9 | 10 | /** 11 | * @author 如果需要监听短信是否被对方成功接收,只需实现这个接口并初始化一个 Spring Bean 即可。 12 | */ 13 | @Component 14 | public class SmsReportMessageListener 15 | implements com.alibaba.alicloud.sms.SmsReportMessageListener { 16 | private List smsReportMessageSet = new LinkedList<>(); 17 | 18 | @Override 19 | public boolean dealMessage(Message message) { 20 | smsReportMessageSet.add(message); 21 | System.err.println(this.getClass().getName() + "; " + message.toString()); 22 | return true; 23 | } 24 | 25 | public List getSmsReportMessageSet() { 26 | 27 | return smsReportMessageSet; 28 | } 29 | } -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/cloud/nacos/NacosConfigAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class NacosConfigAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/aliyuncs/dysmsapi/model/v20170525/SendSmsRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.aliyuncs.dysmsapi.model.v20170525; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class SendSmsRequest { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/SmsReportMessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms; 17 | 18 | /** 19 | * @author pbting 20 | */ 21 | public interface SmsReportMessageListener extends SmsMessageListener { 22 | } -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/cloud/nacos/NacosDiscoveryAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class NacosDiscoveryAutoConfiguration { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/csp/sentinel/datasource/nacos/NacosDataSource.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.csp.sentinel.datasource.nacos; 18 | 19 | /** 20 | * @author xiaolongzuo 21 | */ 22 | public class NacosDataSource { 23 | } 24 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-alibaba-nacos-config/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alibaba-nacos-config 11 | Spring Cloud Starter Alibaba Nacos Config 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alibaba-nacos-config 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/spring-cloud-starter-alicloud-schedulerx/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alicloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alicloud-schedulerx 11 | Spring Cloud Starter Alibaba Cloud SchedulerX 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alicloud-schedulerx 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 11 | We recommend using English. If you are non-native English speaker, you can use the translation software. 12 | 13 | 14 | **Which Component** 15 | eg. Nacos Discovery, Sentinel 16 | 17 | **Is your feature request related to a problem? Please describe.** 18 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 19 | 20 | **Describe the solution you'd like** 21 | A clear and concise description of what you want to happen. 22 | 23 | **Describe alternatives you've considered** 24 | A clear and concise description of any alternative solutions or features you've considered. 25 | 26 | **Additional context** 27 | Add any other context or screenshots about the feature request here. 28 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-alibaba-nacos-discovery/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alibaba-nacos-discovery 11 | Spring Cloud Starter Alibaba Nacos Discovery 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alibaba-nacos-discovery 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/spring-cloud-starter-alicloud-ans/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alicloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | 11 | spring-cloud-starter-alicloud-ans 12 | Spring Cloud Starter Alibaba Cloud ANS 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-alicloud-ans 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-alibaba-nacos-config-server/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alibaba-nacos-config-server 11 | Spring Cloud Starter Alibaba Nacos Config Server 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alibaba-nacos-config 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。 11 | We recommend using English. If you are non-native English speaker, you can use the translation software. 12 | 13 | **Which Component** 14 | eg. Nacos Discovery, Sentinel 15 | 16 | **Describe the bug** 17 | A clear and concise description of what the bug is. 18 | 19 | **To Reproduce** 20 | Steps to reproduce the behavior: 21 | 1. Go to '...' 22 | 2. Click on '....' 23 | 3. Scroll down to '....' 24 | 4. See error 25 | 26 | **Expected behavior** 27 | A clear and concise description of what you expected to happen. 28 | 29 | **Screenshots** 30 | If applicable, add screenshots to help explain your problem. 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | e.g. MacOS 、Java8 、 Version 0.2.1.RELEASE 35 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/base/MessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms.base; 17 | 18 | import com.aliyun.mns.model.Message; 19 | 20 | public interface MessageListener { 21 | 22 | boolean dealMessage(Message message); 23 | 24 | } 25 | -------------------------------------------------------------------------------- /Roadmap-zh.md: -------------------------------------------------------------------------------- 1 | # Roadmap 2 | 3 | Spring Cloud Alibaba 致力于提供分布式应用服务开发的一站式解决方案。项目包含开发分布式应用服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来开发分布式应用服务。 4 | 5 | 此项目包含的组件内容,主要选取自阿里巴巴开源中间件和阿里云商业化产品,但也不限定于这些产品。 6 | 7 | 如果您对 Roadmap 有任何建议或想法,欢迎在 issues 中或者通过其他社区渠道向我们提出,一起讨论。 8 | 9 | 10 | ## 已包含的组件 11 | 12 | **Sentinel** 13 | 14 | 阿里巴巴开源产品,把流量作为切入点,从流量控制、熔断降级、系统负载保护等多个维度保护服务的稳定性。 15 | 16 | **Nacos** 17 | 18 | 阿里巴巴开源产品,一个更易于构建云原生应用的动态服务发现、配置管理和服务管理平台。 19 | 20 | **RocketMQ** 21 | 22 | Apache RocketMQ™ 基于 Java 的高性能、高吞吐量的分布式消息和流计算平台。 23 | 24 | **Dubbo** 25 | 26 | Apache Dubbo™ 是一款高性能 Java RPC 框架。 27 | 28 | **Seata** 29 | 30 | 阿里巴巴开源产品,一个易于使用的高性能微服务分布式事务解决方案。 31 | 32 | **Alibaba Cloud OSS** 33 | 34 | 阿里云对象存储服务(Object Storage Service,简称 OSS),是阿里云提供的海量、安全、低成本、高可靠的云存储服务。您可以在任何应用、任何时间、任何地点存储和访问任意类型的数据。 35 | 36 | **Alibaba Cloud SchedulerX** 37 | 38 | 阿里中间件团队开发的一款分布式任务调度产品,支持周期性的任务与固定时间点触发任务。 39 | 40 | **Alibaba Cloud SMS** 41 | 42 | 覆盖全球的短信服务,友好、高效、智能的互联化通讯能力,帮助企业迅速搭建客户触达通道。 43 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-stream-rocketmq/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../pom.xml 10 | 11 | spring-cloud-starter-stream-rocketmq 12 | Spring Cloud Starter Stream RocketMQ 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-stream-binder-rocketmq 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/SmsMessageListener.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms; 17 | 18 | import com.alibaba.alicloud.sms.base.MessageListener; 19 | 20 | /** 21 | * @author pbting 22 | */ 23 | public interface SmsMessageListener extends MessageListener { 24 | } 25 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-provider-example/readme-zh.md: -------------------------------------------------------------------------------- 1 | # ANS Provider Example 2 | 3 | ## 项目说明 4 | 5 | 本项目展示了,在Spring Cloud规范下,如何以最简单且免费的方式,发布一个服务。 6 | 7 | ## 示例 8 | 9 | ### 准备工作 10 | 11 | ANS支持直接使用免费的轻量版配置中心,进行开发和调试工作。本示例也是基于轻量版配置中心的,因此我们需要首先安装和启动轻量版配置中心。 12 | 13 | 1. [下载轻量版配置中心](https://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/LCC/2018-11-01/edas-lite-configcenter.tar.gz?file=edas-lite-configcenter.tar.gz) 14 | 15 | 2. 解压 edas-lite-configcenter.tar.gz ,然后执行以下命令。 16 | 17 | cd edas-config-center && sh startup.sh 18 | 19 | 出现以下内容说明轻量版配置中心启动成功。 20 | 21 | Edas-config-center has been started successfully. 22 | You can see more details in logs/config-center.log. 23 | 24 | 25 | ### 启动应用 26 | 27 | 直接运行main class,即`ProviderApplication`。 28 | 29 | ### 查看效果 30 | 31 | 进入页面 http://127.0.0.1:8080,在左侧"服务列表"页面中,可以看到一条名为`ans-provider`的服务。 32 | 33 | 34 | 如果您对 Spring Cloud ANS Starter 有任何建议或想法,欢迎提交 issue 中或者通过其他社区渠道向我们反馈。 35 | 36 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/test/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-alibaba-dubbo 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | config: 9 | server-addr: 127.0.0.1:8848 10 | zookeeper: 11 | enabled: false 12 | 13 | main: 14 | allow-bean-definition-overriding: true 15 | 16 | eureka: 17 | client: 18 | enabled: false 19 | 20 | --- 21 | spring: 22 | profiles: eureka 23 | cloud: 24 | nacos: 25 | discovery: 26 | enabled: false 27 | register-enabled: false 28 | 29 | eureka: 30 | client: 31 | enabled: true 32 | service-url: 33 | defaultZone: http://localhost:9090/eureka/ 34 | 35 | --- 36 | spring: 37 | profiles: zookeeper 38 | 39 | cloud: 40 | nacos: 41 | discovery: 42 | enabled: false 43 | register-enabled: false 44 | 45 | zookeeper: 46 | enabled: true 47 | connect-string: localhost:2181 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-alibaba-examples 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | 14 | nacos-gateway-example 15 | pom 16 | Example demonstrating how to use gateway with nacos 17 | 18 | 19 | 20 | nacos-gateway-discovery-example 21 | nacos-gateway-provider-example 22 | 23 | 24 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-dubbo/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | spring-cloud-starter-dubbo 14 | Spring Cloud Starter Dubbo 15 | 16 | 17 | 18 | ${project.groupId} 19 | spring-cloud-alibaba-dubbo 20 | ${project.version} 21 | 22 | 23 | 24 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-schedulerx/src/main/java/com/alibaba/alicloud/scx/ScxAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.scx; 18 | 19 | import org.springframework.context.annotation.Configuration; 20 | 21 | /** 22 | * placeholder configuration 23 | * 24 | * @author xiaolongzuo 25 | */ 26 | @Configuration 27 | public class ScxAutoConfiguration { 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-oss/src/main/java/com/alibaba/alicloud/oss/OssConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.oss; 18 | 19 | /** 20 | * OSS constants 21 | * 22 | * @author Jim 23 | */ 24 | public interface OssConstants { 25 | 26 | String PREFIX = "spring.cloud.alibaba.oss"; 27 | String ENABLED = PREFIX + ".enabled"; 28 | 29 | } 30 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-datasource/src/main/java/com/alibaba/cloud/sentinel/datasource/SentinelDataSourceConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.sentinel.datasource; 18 | 19 | /** 20 | * @author Jim 21 | */ 22 | public interface SentinelDataSourceConstants { 23 | 24 | String PROPERTY_PREFIX = "spring.cloud.sentinel"; 25 | 26 | } 27 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/spring-cloud-starter-alicloud-oss/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alicloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | spring-cloud-starter-alicloud-oss 11 | Spring Cloud Starter Alibaba Cloud OSS 12 | 13 | 14 | 15 | com.alibaba.cloud 16 | spring-cloud-alicloud-oss 17 | 18 | 19 | com.aliyun.oss 20 | aliyun-sdk-oss 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /spring-cloud-starter-alicloud/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.alibaba.cloud 6 | spring-cloud-alibaba 7 | 2.1.1.BUILD-SNAPSHOT 8 | 9 | spring-cloud-starter-alicloud 10 | pom 11 | Spring Cloud Alibaba Cloud Starters 12 | Spring Cloud Alibaba Cloud Starters 13 | 14 | spring-cloud-starter-alicloud-oss 15 | spring-cloud-starter-alicloud-acm 16 | spring-cloud-starter-alicloud-ans 17 | spring-cloud-starter-alicloud-schedulerx 18 | spring-cloud-starter-alicloud-sms 19 | 20 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/resources/META-INF/additional-spring-configuration-metadata.json: -------------------------------------------------------------------------------- 1 | {"properties": [ 2 | { 3 | "name": "spring.cloud.nacos.discovery.service", 4 | "type": "java.lang.String", 5 | "defaultValue": "${spring.application.name}", 6 | "description": "the service name to register, default value is ${spring.application.name}." 7 | }, 8 | { 9 | "name": "spring.cloud.nacos.discovery.enabled", 10 | "type": "java.lang.Boolean", 11 | "defaultValue": true, 12 | "description": "enable nacos discovery or not." 13 | }, 14 | { 15 | "name": "spring.cloud.nacos.discovery.namingLoadCacheAtStart", 16 | "type": "java.lang.Boolean", 17 | "defaultValue": "false", 18 | "description": "naming load from local cache at application start ." 19 | }, 20 | { 21 | "name": "spring.cloud.nacos.discovery.watch.enabled", 22 | "type": "java.lang.Boolean", 23 | "defaultValue": "true", 24 | "description": "enable nacos discovery watch or not ." 25 | } 26 | ]} 27 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.cloud.bootstrap.BootstrapConfiguration=\ 2 | com.alibaba.alicloud.context.acm.AcmContextBootstrapConfiguration 3 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 4 | com.alibaba.alicloud.context.AliCloudContextAutoConfiguration,\ 5 | com.alibaba.alicloud.context.edas.EdasContextAutoConfiguration,\ 6 | com.alibaba.alicloud.context.ans.AnsContextAutoConfiguration,\ 7 | com.alibaba.alicloud.context.oss.OssContextAutoConfiguration,\ 8 | com.alibaba.alicloud.context.scx.ScxContextAutoConfiguration,\ 9 | com.alibaba.alicloud.context.statistics.StatisticsTaskStarter,\ 10 | com.alibaba.alicloud.context.sms.SmsContextAutoConfiguration 11 | org.springframework.context.ApplicationListener=\ 12 | com.alibaba.alicloud.context.ans.AnsContextApplicationListener,\ 13 | com.alibaba.alicloud.context.nacos.NacosConfigParameterInitListener,\ 14 | com.alibaba.alicloud.context.nacos.NacosDiscoveryParameterInitListener,\ 15 | com.alibaba.alicloud.context.sentinel.SentinelAliCloudListener -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-servlet-gateway-sample/src/main/java/com/alibaba/cloud/dubbo/bootstrap/DubboSpringCloudServletGatewayBootstrap.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.dubbo.bootstrap; 2 | 3 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 4 | import org.springframework.boot.builder.SpringApplicationBuilder; 5 | import org.springframework.boot.web.servlet.ServletComponentScan; 6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 7 | import org.springframework.cloud.openfeign.EnableFeignClients; 8 | 9 | /** 10 | * Dubbo Spring Cloud Servlet Gateway Bootstrap 11 | */ 12 | @EnableDiscoveryClient 13 | @EnableAutoConfiguration 14 | @EnableFeignClients 15 | @ServletComponentScan(basePackages = "com.alibaba.cloud.dubbo.gateway") 16 | public class DubboSpringCloudServletGatewayBootstrap { 17 | 18 | public static void main(String[] args) { 19 | new SpringApplicationBuilder(DubboSpringCloudServletGatewayBootstrap.class) 20 | .properties("spring.profiles.active=nacos").run(args); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.stereotype.Service; 20 | 21 | /** 22 | * @author xiaolongzuo 23 | */ 24 | @Service 25 | public class TestService { 26 | 27 | public void test() { 28 | TestController.atomicInteger.incrementAndGet(); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/rocketmq-example/rocketmq-consume-example/src/main/java/com/alibaba/cloud/examples/ReceiveService.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.cloud.stream.annotation.StreamListener; 4 | import org.springframework.messaging.handler.annotation.Payload; 5 | import org.springframework.stereotype.Service; 6 | 7 | /** 8 | * @author Jim 9 | */ 10 | @Service 11 | public class ReceiveService { 12 | 13 | @StreamListener("input1") 14 | public void receiveInput1(String receiveMsg) { 15 | System.out.println("input1 receive: " + receiveMsg); 16 | } 17 | 18 | @StreamListener("input2") 19 | public void receiveInput2(String receiveMsg) { 20 | System.out.println("input2 receive: " + receiveMsg); 21 | } 22 | 23 | @StreamListener("input3") 24 | public void receiveInput3(@Payload Foo foo) { 25 | System.out.println("input3 receive: " + foo); 26 | } 27 | 28 | @StreamListener("input4") 29 | public void receiveTransactionalMsg(String transactionMsg) { 30 | System.out.println("input4 receive transaction msg: " + transactionMsg); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-docs/src/main/asciidoc-zh/introduction.adoc: -------------------------------------------------------------------------------- 1 | ## 介绍 2 | 3 | Spring Cloud Alibaba 致力于提供微服务开发的一站式解决方案。此项目包含开发分布式应用服务的必需组件,方便开发者通过 Spring Cloud 编程模型轻松使用这些组件来开发分布式应用服务。 4 | 5 | 依托 Spring Cloud Alibaba,您只需要添加一些注解和少量配置,就可以将 Spring Cloud 应用接入阿里分布式应用解决方案,通过阿里中间件来迅速搭建分布式应用系统。 6 | 7 | 目前 Spring Cloud Alibaba 提供了如下功能: 8 | 9 | 1. **服务限流降级**:支持 WebServlet、WebFlux, OpenFeign、RestTemplate、Dubbo 限流降级功能的接入,可以在运行时通过控制台实时修改限流降级规则,还支持查看限流降级 Metrics 监控。 10 | 2. **服务注册与发现**:适配 Spring Cloud 服务注册与发现标准,默认集成了 Ribbon 的支持。 11 | 3. **分布式配置管理**:支持分布式系统中的外部化配置,配置更改时自动刷新。 12 | 4. **Rpc服务**:扩展 Spring Cloud 客户端 RestTemplate 和 OpenFeign,支持调用 Dubbo RPC 服务 13 | 5. **消息驱动能力**:基于 Spring Cloud Stream 为微服务应用构建消息驱动能力。 14 | 6. **分布式事务**:使用 @GlobalTransactional 注解, 高效并且对业务零侵入地解决分布式事务问题。 15 | 7. **阿里云对象存储**:阿里云提供的海量、安全、低成本、高可靠的云存储服务。支持在任何应用、任何时间、任何地点存储和访问任意类型的数据。 16 | 8. **分布式任务调度**:提供秒级、精准、高可靠、高可用的定时(基于 Cron 表达式)任务调度服务。同时提供分布式的任务执行模型,如网格任务。网格任务支持海量子任务均匀分配到所有 Worker(schedulerx-client)上执行。 17 | 9. **阿里云短信服务**:覆盖全球的短信服务,友好、高效、智能的互联化通讯能力,帮助企业迅速搭建客户触达通道。 18 | 19 | Spring Cloud Alibaba 也提供了丰富的 https://github.com/alibaba/spring-cloud-alibaba/tree/master/spring-cloud-alibaba-examples[examples]。 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-alibaba-examples 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | 13 | 14 | nacos-discovery-example 15 | pom 16 | Example demonstrating how to use nacos discovery 17 | 18 | 19 | 20 | nacos-discovery-consumer-example 21 | nacos-discovery-provider-example 22 | nacos-discovery-spring-cloud-config-server 23 | nacos-discovery-spring-cloud-config-client 24 | 25 | 26 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sms-example/src/main/java/com/alibaba/cloud/example/SmsApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.cloud.example; 17 | 18 | import org.springframework.boot.SpringApplication; 19 | import org.springframework.boot.autoconfigure.SpringBootApplication; 20 | 21 | /** 22 | * 23 | */ 24 | @SpringBootApplication 25 | public class SmsApplication { 26 | 27 | public static void main(String[] args) throws Exception { 28 | SpringApplication.run(SmsApplication.class, args); 29 | } 30 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/resources/META-INF/spring.factories: -------------------------------------------------------------------------------- 1 | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ 2 | com.alibaba.cloud.dubbo.autoconfigure.DubboMetadataAutoConfiguration,\ 3 | com.alibaba.cloud.dubbo.autoconfigure.DubboOpenFeignAutoConfiguration,\ 4 | com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationAutoConfiguration,\ 5 | com.alibaba.cloud.dubbo.autoconfigure.DubboServiceRegistrationNonWebApplicationAutoConfiguration,\ 6 | com.alibaba.cloud.dubbo.autoconfigure.DubboLoadBalancedRestTemplateAutoConfiguration,\ 7 | com.alibaba.cloud.dubbo.autoconfigure.DubboServiceAutoConfiguration,\ 8 | com.alibaba.cloud.dubbo.autoconfigure.DubboServiceDiscoveryAutoConfiguration 9 | 10 | org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration=\ 11 | com.alibaba.cloud.dubbo.actuate.DubboMetadataEndpointAutoConfiguration 12 | 13 | org.springframework.context.ApplicationContextInitializer=\ 14 | com.alibaba.cloud.dubbo.context.DubboServiceRegistrationApplicationContextInitializer 15 | 16 | org.springframework.boot.env.EnvironmentPostProcessor=\ 17 | com.alibaba.cloud.dubbo.env.DubboNonWebApplicationEnvironmentPostProcessor -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-sample-api/src/main/java/com/alibaba/cloud/dubbo/service/EchoService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.service; 18 | 19 | /** 20 | * Echo Service 21 | */ 22 | public interface EchoService { 23 | 24 | String echo(String message); 25 | } 26 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/SeataFeignBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.seata.feign; 18 | 19 | import org.springframework.beans.factory.BeanFactory; 20 | 21 | import feign.Feign; 22 | 23 | /** 24 | * @author xiaojing 25 | */ 26 | final class SeataFeignBuilder { 27 | 28 | private SeataFeignBuilder() { 29 | } 30 | 31 | static Feign.Builder builder(BeanFactory beanFactory) { 32 | return Feign.builder().client(new SeataFeignClient(beanFactory)); 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/SentinelConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.sentinel; 18 | 19 | /** 20 | * @author fangjian 21 | */ 22 | public interface SentinelConstants { 23 | 24 | String PROPERTY_PREFIX = "spring.cloud.sentinel"; 25 | 26 | String BLOCK_TYPE = "block"; 27 | String FALLBACK_TYPE = "fallback"; 28 | 29 | // commercialization 30 | 31 | String FLOW_DATASOURCE_NAME = "edas-flow"; 32 | String DEGRADE_DATASOURCE_NAME = "edas-degrade"; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/ServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.context.annotation.Bean; 6 | import org.springframework.web.client.RestTemplate; 7 | 8 | import com.alibaba.cloud.sentinel.annotation.SentinelRestTemplate; 9 | import com.alibaba.csp.sentinel.datasource.Converter; 10 | 11 | /** 12 | * @author xiaojing 13 | */ 14 | @SpringBootApplication 15 | public class ServiceApplication { 16 | 17 | @Bean 18 | @SentinelRestTemplate(blockHandler = "handleException", blockHandlerClass = ExceptionUtil.class) 19 | public RestTemplate restTemplate() { 20 | return new RestTemplate(); 21 | } 22 | 23 | @Bean 24 | public RestTemplate restTemplate2() { 25 | return new RestTemplate(); 26 | } 27 | 28 | @Bean 29 | public Converter myConverter() { 30 | return new JsonFlowRuleListConverter(); 31 | } 32 | 33 | public static void main(String[] args) { 34 | SpringApplication.run(ServiceApplication.class, args); 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/endpoint/SmsEndpoint.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms.endpoint; 17 | 18 | import java.util.Map; 19 | 20 | import org.springframework.boot.actuate.endpoint.annotation.Endpoint; 21 | import org.springframework.boot.actuate.endpoint.annotation.ReadOperation; 22 | 23 | @Endpoint(id = "sms") 24 | public class SmsEndpoint { 25 | 26 | @ReadOperation 27 | public Map invoke() { 28 | 29 | return EndpointManager.getSmsEndpointMessage(); 30 | } 31 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/account-service/src/main/java/com/alibaba/cloud/examples/AccountApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author xiaojing 24 | */ 25 | @SpringBootApplication 26 | public class AccountApplication { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(AccountApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/storage-service/src/main/java/com/alibaba/cloud/examples/StorageApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author xiaojing 24 | */ 25 | @SpringBootApplication 26 | public class StorageApplication { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(StorageApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/ScxApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author xiaolongzuo 24 | */ 25 | @SpringBootApplication 26 | public class ScxApplication { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(ScxApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/rocketmq-example/rocketmq-produce-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | logging.level.com.alibaba.cloud.stream.binder.rocketmq=DEBUG 2 | 3 | spring.cloud.stream.rocketmq.binder.name-server=127.0.0.1:9876 4 | 5 | spring.cloud.stream.bindings.output1.destination=test-topic 6 | spring.cloud.stream.bindings.output1.content-type=application/json 7 | spring.cloud.stream.rocketmq.bindings.output1.producer.group=binder-group 8 | spring.cloud.stream.rocketmq.bindings.output1.producer.sync=true 9 | 10 | spring.cloud.stream.bindings.output2.destination=TransactionTopic 11 | spring.cloud.stream.bindings.output2.content-type=application/json 12 | spring.cloud.stream.rocketmq.bindings.output2.producer.transactional=true 13 | spring.cloud.stream.rocketmq.bindings.output2.producer.group=myTxProducerGroup 14 | 15 | spring.cloud.stream.bindings.output3.destination=pull-topic 16 | spring.cloud.stream.bindings.output3.content-type=text/plain 17 | spring.cloud.stream.rocketmq.bindings.output3.producer.group=pull-binder-group 18 | 19 | spring.application.name=rocketmq-produce-example 20 | 21 | server.port=28081 22 | 23 | management.endpoints.web.exposure.include=* 24 | management.endpoint.health.show-details=always -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 18086 3 | spring: 4 | application: 5 | name: sentinel-zuul 6 | cloud: 7 | sentinel: 8 | datasource.ds2.file: 9 | file: "classpath: gateway.json" 10 | ruleType: gw-flow 11 | datasource.ds1.file: 12 | file: "classpath: api.json" 13 | ruleType: gw-api-group 14 | transport: 15 | dashboard: localhost:8080 16 | filter: 17 | enabled: false 18 | 19 | management.endpoints.web.exposure.include: "*" 20 | 21 | 22 | zuul.routes.my-service.path: "/product/foo/**" 23 | zuul.routes.my-service.service-id: "my-service" 24 | 25 | zuul.routes.my-service2.path: "/my-service2/**" 26 | zuul.routes.my-service2.service-id: "my-service2" 27 | 28 | zuul.routes.my-service3.path: "/my-service3/**" 29 | zuul.routes.my-service3.service-id: "my-service3" 30 | 31 | zuul.routes.my-service4.path: "/my-service4/**" 32 | zuul.routes.my-service4.service-id: "my-service4" 33 | 34 | 35 | spring.cloud.sentinel.zuul.order.pre: 2000 36 | spring.cloud.sentinel.zuul.order.post: 500 37 | spring.cloud.sentinel.zuul.order.error: -100 38 | 39 | 40 | spring.cloud.sentinel.zuul.enabled: true -------------------------------------------------------------------------------- /spring-cloud-stream-binder-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/RocketMQBinderConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.stream.binder.rocketmq; 18 | 19 | /** 20 | * @author Jim 21 | */ 22 | public interface RocketMQBinderConstants { 23 | 24 | /** 25 | * Header key 26 | */ 27 | String ROCKET_TRANSACTIONAL_ARG = "TRANSACTIONAL_ARG"; 28 | 29 | /** 30 | * Default value 31 | */ 32 | String DEFAULT_NAME_SERVER = "127.0.0.1:9876"; 33 | 34 | String DEFAULT_GROUP = "rocketmq_binder_default_group_name"; 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/java/com/alibaba/cloud/examples/EchoService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.cloud.openfeign.FeignClient; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestParam; 22 | 23 | /** 24 | * @author xiaolongzuo 25 | */ 26 | @FeignClient(value = "ans-provider") 27 | public interface EchoService { 28 | 29 | @RequestMapping(path = "echo/{str}") 30 | String echo(@RequestParam("str") String param); 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import java.io.Serializable; 20 | 21 | public class Order implements Serializable { 22 | public long id; 23 | public String userId; 24 | public String commodityCode; 25 | public int count; 26 | public int money; 27 | 28 | @Override 29 | public String toString() { 30 | return "Order{" + "id=" + id + ", userId='" + userId + '\'' + ", commodityCode='" 31 | + commodityCode + '\'' + ", count=" + count + ", money=" + money + '}'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-alibaba-dubbo-provider 4 | main: 5 | allow-bean-definition-overriding: true 6 | 7 | 8 | # default disable all 9 | cloud: 10 | nacos: 11 | discovery: 12 | enabled: false 13 | register-enabled: false 14 | zookeeper: 15 | enabled: false 16 | consul: 17 | enabled: false 18 | 19 | eureka: 20 | client: 21 | enabled: false 22 | 23 | 24 | --- 25 | spring: 26 | profiles: nacos 27 | 28 | cloud: 29 | nacos: 30 | discovery: 31 | enabled: true 32 | register-enabled: true 33 | server-addr: 127.0.0.1:8848 34 | 35 | 36 | --- 37 | spring: 38 | profiles: eureka 39 | 40 | eureka: 41 | client: 42 | enabled: true 43 | service-url: 44 | defaultZone: http://127.0.0.1:8761/eureka/ 45 | 46 | 47 | --- 48 | spring: 49 | profiles: zookeeper 50 | cloud: 51 | zookeeper: 52 | enabled: true 53 | connect-string: 127.0.0.1:2181 54 | 55 | 56 | --- 57 | spring: 58 | profiles: consul 59 | 60 | cloud: 61 | consul: 62 | enabled: true 63 | host: 127.0.0.1 64 | port: 8500 -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel-gateway/src/main/java/com/alibaba/cloud/sentinel/gateway/ConfigConstants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.sentinel.gateway; 18 | 19 | /** 20 | * @author Jim 21 | */ 22 | public interface ConfigConstants { 23 | 24 | String APP_TYPE_ZUUL_GATEWAY = "12"; 25 | String APP_TYPE_SCG_GATEWAY = "11"; 26 | 27 | String ZUUl_PREFIX = "spring.cloud.sentinel.zuul"; 28 | 29 | String GATEWAY_PREFIX = "spring.cloud.sentinel.scg"; 30 | 31 | String FALLBACK_MSG_RESPONSE = "response"; 32 | String FALLBACK_REDIRECT = "redirect"; 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/HelloController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.web.bind.annotation.RequestMapping; 20 | import org.springframework.web.bind.annotation.ResponseBody; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | /** 24 | * @author xiaolongzuo 25 | */ 26 | @RestController 27 | public class HelloController { 28 | 29 | @RequestMapping("/") 30 | @ResponseBody 31 | public String hello() { 32 | return "OK"; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/business-service/src/main/java/com/alibaba/cloud/examples/Order.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import java.io.Serializable; 20 | 21 | public class Order implements Serializable { 22 | public long id; 23 | public String userId; 24 | public String commodityCode; 25 | public int count; 26 | public int money; 27 | 28 | @Override 29 | public String toString() { 30 | return "Order{" + "id=" + id + ", userId='" + userId + '\'' + ", commodityCode='" 31 | + commodityCode + '\'' + ", count=" + count + ", money=" + money + '}'; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-dubbo-example/sentinel-dubbo-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-alibaba-examples 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../../pom.xml 10 | 11 | 4.0.0 12 | 13 | sentinel-dubbo-api 14 | jar 15 | api for sentinel dubbo example 16 | 17 | 18 | 19 | 20 | org.apache.maven.plugins 21 | maven-deploy-plugin 22 | ${maven-deploy-plugin.version} 23 | 24 | true 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-provider-web-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-alibaba-dubbo-provider 4 | main: 5 | allow-bean-definition-overriding: true 6 | 7 | 8 | # default disable all 9 | cloud: 10 | nacos: 11 | discovery: 12 | enabled: false 13 | register-enabled: false 14 | zookeeper: 15 | enabled: false 16 | consul: 17 | enabled: false 18 | 19 | eureka: 20 | client: 21 | enabled: false 22 | 23 | 24 | --- 25 | spring: 26 | profiles: nacos 27 | 28 | cloud: 29 | nacos: 30 | discovery: 31 | enabled: true 32 | register-enabled: true 33 | server-addr: 127.0.0.1:8848 34 | 35 | 36 | --- 37 | spring: 38 | profiles: eureka 39 | 40 | eureka: 41 | client: 42 | enabled: true 43 | service-url: 44 | defaultZone: http://127.0.0.1:8761/eureka/ 45 | 46 | 47 | --- 48 | spring: 49 | profiles: zookeeper 50 | cloud: 51 | zookeeper: 52 | enabled: true 53 | connect-string: 127.0.0.1:2181 54 | 55 | 56 | --- 57 | spring: 58 | profiles: consul 59 | 60 | cloud: 61 | consul: 62 | enabled: true 63 | host: 127.0.0.1 64 | port: 8500 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-sample-api/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-alibaba-dubbo-examples 8 | 2.1.1.BUILD-SNAPSHOT 9 | 10 | 4.0.0 11 | 12 | com.alibaba.cloud 13 | spring-cloud-dubbo-sample-api 14 | Spring Cloud Dubbo Sample API 15 | 16 | 17 | 18 | 19 | org.slf4j 20 | slf4j-api 21 | 1.7.25 22 | 23 | 24 | 25 | 26 | org.apache.dubbo 27 | dubbo 28 | ${dubbo.version} 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-webflux-example/src/main/java/com/alibaba/cloud/examples/SentinelWebFluxApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author Jim 24 | */ 25 | @SpringBootApplication 26 | public class SentinelWebFluxApplication { 27 | 28 | public static void main(String[] args) { 29 | SpringApplication.run(SentinelWebFluxApplication.class, args); 30 | } 31 | 32 | } 33 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/spring-cloud-starter-bus-rocketmq/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | com.alibaba.cloud 7 | spring-cloud-starter-alibaba 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../pom.xml 10 | 11 | 4.0.0 12 | 13 | spring-cloud-starter-bus-rocketmq 14 | Spring Cloud Alibaba Bus RocketMQ 15 | 16 | 17 | 18 | 19 | 20 | com.alibaba.cloud 21 | spring-cloud-stream-binder-rocketmq 22 | 23 | 24 | 25 | 26 | org.springframework.cloud 27 | spring-cloud-bus 28 | 29 | 30 | 31 | 32 | 33 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/resources/application.yaml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 18085 3 | spring: 4 | application: 5 | name: sentinel-spring-cloud-gateway 6 | cloud: 7 | gateway: 8 | enabled: true 9 | discovery: 10 | locator: 11 | lower-case-service-id: true 12 | routes: 13 | # Add your routes here. 14 | - id: aliyun_route 15 | uri: https://www.aliyun.com/ 16 | predicates: 17 | - Path=/product/** 18 | - id: httpbin_route 19 | uri: https://httpbin.org 20 | predicates: 21 | - Path=/httpbin/** 22 | filters: 23 | - RewritePath=/httpbin/(?.*), /$\{segment} 24 | 25 | sentinel: 26 | datasource.ds2.file: 27 | file: "classpath: gateway.json" 28 | ruleType: gw-flow 29 | datasource.ds1.file: 30 | file: "classpath: api.json" 31 | ruleType: gw-api-group 32 | transport: 33 | dashboard: localhost:8080 34 | filter: 35 | enabled: true 36 | scg.fallback: 37 | mode: response 38 | response-status: 444 39 | response-body: 1234 40 | scg: 41 | order: -100 42 | 43 | management.endpoints.web.exposure.include: "*" -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/test/java/com/alibaba/cloud/nacos/test/CommonTestConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos.test; 18 | 19 | import org.springframework.cloud.client.loadbalancer.LoadBalanced; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | import org.springframework.web.client.RestTemplate; 23 | 24 | /** 25 | * @author xiaojing 26 | */ 27 | 28 | @Configuration 29 | public class CommonTestConfig { 30 | 31 | @Bean 32 | @LoadBalanced 33 | RestTemplate loadBalancedRestTemplate() { 34 | return new RestTemplate(); 35 | } 36 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/web/SeataHandlerInterceptorConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.seata.web; 18 | 19 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; 20 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; 21 | 22 | /** 23 | * @author xiaojing 24 | */ 25 | public class SeataHandlerInterceptorConfiguration implements WebMvcConfigurer { 26 | 27 | @Override 28 | public void addInterceptors(InterceptorRegistry registry) { 29 | registry.addInterceptor(new SeataHandlerInterceptor()).addPathPatterns("/**"); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/acm-example/acm-local-example/src/main/java/com/alibaba/cloud/examples/AcmApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | 23 | /** 24 | * @author xiaolongzuo 25 | */ 26 | @SpringBootApplication 27 | @EnableDiscoveryClient 28 | public class AcmApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(AcmApplication.class, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/SeataHystrixFeignBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.seata.feign; 18 | 19 | import org.springframework.beans.factory.BeanFactory; 20 | 21 | import feign.Feign; 22 | import feign.Retryer; 23 | import feign.hystrix.HystrixFeign; 24 | 25 | /** 26 | * @author xiaojing 27 | */ 28 | final class SeataHystrixFeignBuilder { 29 | 30 | private SeataHystrixFeignBuilder() { 31 | } 32 | 33 | static Feign.Builder builder(BeanFactory beanFactory) { 34 | return HystrixFeign.builder().retryer(Retryer.NEVER_RETRY) 35 | .client(new SeataFeignClient(beanFactory)); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | 23 | /** 24 | * @author xiaolongzuo 25 | */ 26 | @SpringBootApplication 27 | @EnableDiscoveryClient 28 | public class ProviderApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(ProviderApplication.class, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/refresh/NacosRefreshProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos.refresh; 18 | 19 | import org.springframework.beans.factory.annotation.Value; 20 | import org.springframework.stereotype.Component; 21 | 22 | /** 23 | * @author xiaojing 24 | */ 25 | @Component 26 | public class NacosRefreshProperties { 27 | 28 | @Value("${spring.cloud.nacos.config.refresh.enabled:true}") 29 | private boolean enabled = true; 30 | 31 | public boolean isEnabled() { 32 | return enabled; 33 | } 34 | 35 | public void setEnabled(boolean enabled) { 36 | this.enabled = enabled; 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-cloud-starter-alibaba/pom.xml: -------------------------------------------------------------------------------- 1 | 3 | 4.0.0 4 | 5 | com.alibaba.cloud 6 | spring-cloud-alibaba 7 | 2.1.1.BUILD-SNAPSHOT 8 | ../pom.xml 9 | 10 | spring-cloud-starter-alibaba 11 | pom 12 | Spring Cloud Alibaba Starters 13 | Spring Cloud Alibaba Starters 14 | 15 | spring-cloud-starter-alibaba-nacos-config 16 | spring-cloud-starter-alibaba-nacos-config-server 17 | spring-cloud-starter-alibaba-nacos-discovery 18 | spring-cloud-starter-alibaba-sentinel 19 | spring-cloud-starter-alibaba-seata 20 | spring-cloud-starter-stream-rocketmq 21 | spring-cloud-starter-bus-rocketmq 22 | spring-cloud-starter-dubbo 23 | 24 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/ribbon/ConditionalOnRibbonNacos.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos.ribbon; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ ElementType.TYPE, ElementType.METHOD }) 28 | @ConditionalOnProperty(value = "ribbon.nacos.enabled", matchIfMissing = true) 29 | public @interface ConditionalOnRibbonNacos { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/test/java/com/alibaba/cloud/dubbo/autoconfigure/DubboServiceRegistrationAutoConfigurationTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.autoconfigure; 18 | 19 | import org.springframework.boot.test.context.SpringBootTest; 20 | 21 | /** 22 | * {@link DubboServiceRegistrationAutoConfiguration} Test 23 | * 24 | * @author Mercy 25 | */ 26 | @SpringBootTest 27 | public class DubboServiceRegistrationAutoConfigurationTest { 28 | } 29 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/SeataSentinelFeignBuilder.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.seata.feign; 18 | 19 | import org.springframework.beans.factory.BeanFactory; 20 | 21 | import com.alibaba.cloud.sentinel.feign.SentinelFeign; 22 | 23 | import feign.Feign; 24 | import feign.Retryer; 25 | 26 | /** 27 | * @author xiaojing 28 | */ 29 | final class SeataSentinelFeignBuilder { 30 | 31 | private SeataSentinelFeignBuilder() { 32 | } 33 | 34 | static Feign.Builder builder(BeanFactory beanFactory) { 35 | return SentinelFeign.builder().retryer(Retryer.NEVER_RETRY) 36 | .client(new SeataFeignClient(beanFactory)); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-sms/src/main/java/com/alibaba/alicloud/sms/endpoint/SmsEndpointAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.alicloud.sms.endpoint; 17 | 18 | import org.springframework.boot.actuate.endpoint.annotation.Endpoint; 19 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 21 | import org.springframework.context.annotation.Bean; 22 | 23 | @ConditionalOnWebApplication 24 | @ConditionalOnClass(Endpoint.class) 25 | public class SmsEndpointAutoConfiguration { 26 | 27 | @Bean 28 | public SmsEndpoint smsEndpoint() { 29 | return new SmsEndpoint(); 30 | } 31 | } -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/main/java/com/alibaba/alicloud/ans/ConditionalOnAnsEnabled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({ ElementType.TYPE, ElementType.METHOD }) 31 | @ConditionalOnProperty(value = "spring.cloud.ans.enabled", matchIfMissing = true) 32 | public @interface ConditionalOnAnsEnabled { 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/ConditionalOnNacosDiscoveryEnabled.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 25 | 26 | @Retention(RetentionPolicy.RUNTIME) 27 | @Target({ ElementType.TYPE, ElementType.METHOD }) 28 | @ConditionalOnProperty(value = "spring.cloud.nacos.discovery.enabled", matchIfMissing = true) 29 | public @interface ConditionalOnNacosDiscoveryEnabled { 30 | 31 | } 32 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-feign-example/src/main/java/com/alibaba/cloud/examples/ConsumerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.openfeign.EnableFeignClients; 22 | 23 | /** 24 | * @author xiaolongzuo 25 | */ 26 | @SpringBootApplication 27 | @EnableFeignClients(basePackages = { "com.alibaba.cloud.examples" }) 28 | public class ConsumerApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(ConsumerApplication.class, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-zuul-example/src/main/java/com/alibaba/cloud/examples/SentinelZuulApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.netflix.zuul.EnableZuulProxy; 22 | 23 | /** 24 | * @author Jim 25 | */ 26 | @SpringBootApplication 27 | @EnableZuulProxy 28 | public class SentinelZuulApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(SentinelZuulApplication.class, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-sample-api/src/main/java/com/alibaba/cloud/dubbo/service/UserService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.service; 18 | 19 | import java.util.Collection; 20 | 21 | /** 22 | * {@link User} Service 23 | * 24 | * @author Mercy 25 | */ 26 | public interface UserService { 27 | 28 | boolean save(User user); 29 | 30 | boolean remove(Long userId); 31 | 32 | Collection findAll(); 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/main/java/com/alibaba/alicloud/ans/ribbon/ConditionalOnRibbonAns.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans.ribbon; 18 | 19 | import java.lang.annotation.ElementType; 20 | import java.lang.annotation.Retention; 21 | import java.lang.annotation.RetentionPolicy; 22 | import java.lang.annotation.Target; 23 | 24 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | */ 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Target({ ElementType.TYPE, ElementType.METHOD }) 31 | @ConditionalOnProperty(value = "ribbon.ans.enabled", matchIfMissing = true) 32 | public @interface ConditionalOnRibbonAns { 33 | 34 | } 35 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-consumer-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-alibaba-dubbo-consumer 4 | main: 5 | allow-bean-definition-overriding: true 6 | 7 | 8 | # default disable all 9 | cloud: 10 | nacos: 11 | discovery: 12 | enabled: false 13 | register-enabled: false 14 | zookeeper: 15 | enabled: false 16 | consul: 17 | enabled: false 18 | 19 | eureka: 20 | client: 21 | enabled: false 22 | 23 | ribbon: 24 | nacos: 25 | enabled: false 26 | 27 | --- 28 | spring: 29 | profiles: nacos 30 | 31 | cloud: 32 | nacos: 33 | discovery: 34 | enabled: true 35 | register-enabled: true 36 | server-addr: 127.0.0.1:8848 37 | 38 | ribbon: 39 | nacos: 40 | enabled: true 41 | 42 | --- 43 | spring: 44 | profiles: eureka 45 | 46 | eureka: 47 | client: 48 | enabled: true 49 | service-url: 50 | defaultZone: http://127.0.0.1:8761/eureka/ 51 | 52 | 53 | --- 54 | spring: 55 | profiles: zookeeper 56 | cloud: 57 | zookeeper: 58 | enabled: true 59 | connect-string: 127.0.0.1:2181 60 | 61 | 62 | --- 63 | spring: 64 | profiles: consul 65 | 66 | cloud: 67 | consul: 68 | enabled: true 69 | host: 127.0.0.1 70 | port: 8500 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/spring-cloud-alibaba-dubbo-examples/spring-cloud-dubbo-servlet-gateway-sample/src/main/resources/bootstrap.yaml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: spring-cloud-alibaba-dubbo-servlet-gateway 4 | main: 5 | allow-bean-definition-overriding: true 6 | 7 | 8 | # default disable all 9 | cloud: 10 | nacos: 11 | discovery: 12 | enabled: false 13 | register-enabled: false 14 | zookeeper: 15 | enabled: false 16 | consul: 17 | enabled: false 18 | 19 | eureka: 20 | client: 21 | enabled: false 22 | 23 | ribbon: 24 | nacos: 25 | enabled: false 26 | 27 | --- 28 | spring: 29 | profiles: nacos 30 | 31 | cloud: 32 | nacos: 33 | discovery: 34 | enabled: true 35 | register-enabled: true 36 | server-addr: 127.0.0.1:8848 37 | 38 | ribbon: 39 | nacos: 40 | enabled: true 41 | 42 | --- 43 | spring: 44 | profiles: eureka 45 | 46 | eureka: 47 | client: 48 | enabled: true 49 | service-url: 50 | defaultZone: http://127.0.0.1:8761/eureka/ 51 | 52 | 53 | --- 54 | spring: 55 | profiles: zookeeper 56 | cloud: 57 | zookeeper: 58 | enabled: true 59 | connect-string: 127.0.0.1:2181 60 | 61 | 62 | --- 63 | spring: 64 | profiles: consul 65 | 66 | cloud: 67 | consul: 68 | enabled: true 69 | host: 127.0.0.1 70 | port: 8500 -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/java/com/alibaba/cloud/examples/TestController.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.beans.factory.annotation.Autowired; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RequestMethod; 6 | import org.springframework.web.bind.annotation.RestController; 7 | import org.springframework.web.client.RestTemplate; 8 | 9 | import com.alibaba.csp.sentinel.annotation.SentinelResource; 10 | 11 | /** 12 | * @author xiaojing 13 | */ 14 | @RestController 15 | public class TestController { 16 | 17 | @Autowired 18 | private RestTemplate restTemplate; 19 | 20 | @RequestMapping(value = "/hello", method = RequestMethod.GET) 21 | @SentinelResource("resource") 22 | public String hello() { 23 | return "Hello"; 24 | } 25 | 26 | @RequestMapping(value = "/aa", method = RequestMethod.GET) 27 | @SentinelResource("aa") 28 | public String aa(int b, int a) { 29 | return "Hello test"; 30 | } 31 | 32 | @RequestMapping(value = "/test", method = RequestMethod.GET) 33 | public String test1() { 34 | return "Hello test"; 35 | } 36 | 37 | @RequestMapping(value = "/template", method = RequestMethod.GET) 38 | public String client() { 39 | return restTemplate.getForObject("http://www.taobao.com/test", String.class); 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-spring-cloud-gateway-example/src/main/java/com/alibaba/cloud/examples/SentinelSpringCloudGatewayApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | 22 | /** 23 | * @author Jim 24 | */ 25 | @SpringBootApplication 26 | public class SentinelSpringCloudGatewayApplication { 27 | 28 | public static void main(String[] args) { 29 | // GatewayCallbackManager.setRequestOriginParser(s -> "123"); 30 | SpringApplication.run(SentinelSpringCloudGatewayApplication.class, args); 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigClientApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | 23 | /** 24 | * @author JevonYang 25 | */ 26 | @SpringBootApplication 27 | @EnableDiscoveryClient 28 | public class SpringCloudConfigClientApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(SpringCloudConfigClientApplication.class, args); 32 | } 33 | 34 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/feign/hystrix/SeataHystrixAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | package com.alibaba.cloud.seata.feign.hystrix; 17 | 18 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 19 | import org.springframework.context.annotation.Bean; 20 | import org.springframework.context.annotation.Configuration; 21 | 22 | import com.netflix.hystrix.HystrixCommand; 23 | 24 | /** 25 | * @author xiaojing 26 | */ 27 | 28 | @Configuration 29 | @ConditionalOnClass(HystrixCommand.class) 30 | public class SeataHystrixAutoConfiguration { 31 | 32 | @Bean 33 | SeataHystrixConcurrencyStrategy seataHystrixConcurrencyStrategy() { 34 | return new SeataHystrixConcurrencyStrategy(); 35 | } 36 | 37 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/order-service/src/main/java/com/alibaba/cloud/examples/OderApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.context.annotation.Bean; 22 | import org.springframework.web.client.RestTemplate; 23 | 24 | /** 25 | * @author xiaojing 26 | */ 27 | @SpringBootApplication 28 | public class OderApplication { 29 | 30 | public static void main(String[] args) { 31 | SpringApplication.run(OderApplication.class, args); 32 | } 33 | 34 | @Bean 35 | public RestTemplate restTemplate() { 36 | return new RestTemplate(); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/sentinel-example/sentinel-core-example/src/main/resources/application.properties: -------------------------------------------------------------------------------- 1 | spring.application.name=sentinel-example 2 | server.port=18083 3 | management.endpoints.web.exposure.include=* 4 | management.endpoint.health.show-details=always 5 | 6 | # we can disable health check, default is enable 7 | management.health.diskspace.enabled=false 8 | # management.health.sentinel.enabled=false 9 | 10 | spring.cloud.sentinel.transport.dashboard=localhost:8080 11 | spring.cloud.sentinel.eager=true 12 | #spring.cloud.sentinel.http-method-specify=false 13 | 14 | spring.cloud.sentinel.datasource.ds1.file.file=classpath: flowrule.json 15 | spring.cloud.sentinel.datasource.ds1.file.data-type=json 16 | spring.cloud.sentinel.datasource.ds1.file.rule-type=flow 17 | 18 | spring.cloud.sentinel.datasource.ds2.file.file=classpath: degraderule.json 19 | spring.cloud.sentinel.datasource.ds2.file.data-type=json 20 | spring.cloud.sentinel.datasource.ds2.file.rule-type=degrade 21 | 22 | spring.cloud.sentinel.datasource.ds3.file.file=classpath: authority.json 23 | spring.cloud.sentinel.datasource.ds3.file.rule-type=authority 24 | 25 | spring.cloud.sentinel.datasource.ds4.file.file=classpath: system.json 26 | spring.cloud.sentinel.datasource.ds4.file.rule-type=system 27 | 28 | spring.cloud.sentinel.datasource.ds5.file.file=classpath: param-flow.json 29 | spring.cloud.sentinel.datasource.ds5.file.rule-type=param_flow 30 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-client/src/main/java/com/alibaba/cloud/examples/GetConfigController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.beans.factory.annotation.Value; 20 | import org.springframework.web.bind.annotation.RequestMapping; 21 | import org.springframework.web.bind.annotation.RequestMethod; 22 | import org.springframework.web.bind.annotation.RestController; 23 | 24 | @RestController 25 | public class GetConfigController { 26 | 27 | @Value("${config}") 28 | private String config; 29 | 30 | @RequestMapping(value = "/config", method = RequestMethod.GET) 31 | public String getConfig() { 32 | return config; 33 | } 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/Constants.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.context; 18 | 19 | /** 20 | * @author Jim 21 | */ 22 | public interface Constants { 23 | 24 | interface Sentinel { 25 | String PROPERTY_PREFIX = "spring.cloud.sentinel"; 26 | String NACOS_DATASOURCE_AK = PROPERTY_PREFIX + ".nacos.config.access-key"; 27 | String NACOS_DATASOURCE_SK = PROPERTY_PREFIX + ".nacos.config.secret-key"; 28 | String NACOS_DATASOURCE_NAMESPACE = PROPERTY_PREFIX + ".nacos.config.namespace"; 29 | String NACOS_DATASOURCE_ENDPOINT = PROPERTY_PREFIX + ".nacos.config.endpoint"; 30 | String PROJECT_NAME = PROPERTY_PREFIX + ".nacos.config.project-name"; 31 | } 32 | 33 | } 34 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-gateway-example/nacos-gateway-provider-example/src/main/java/com/alibaba/cloud/examples/ProviderApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | import org.springframework.web.bind.annotation.PathVariable; 7 | import org.springframework.web.bind.annotation.RequestMapping; 8 | import org.springframework.web.bind.annotation.RequestMethod; 9 | import org.springframework.web.bind.annotation.RequestParam; 10 | import org.springframework.web.bind.annotation.RestController; 11 | 12 | /** 13 | * @author xiaojing 14 | */ 15 | @SpringBootApplication 16 | @EnableDiscoveryClient 17 | public class ProviderApplication { 18 | 19 | public static void main(String[] args) { 20 | SpringApplication.run(ProviderApplication.class, args); 21 | } 22 | 23 | @RestController 24 | class EchoController { 25 | @RequestMapping(value = "/echo/{string}", method = RequestMethod.GET) 26 | public String echo(@PathVariable String string) { 27 | return "hello Nacos Discovery " + string; 28 | } 29 | 30 | @RequestMapping(value = "/divide", method = RequestMethod.GET) 31 | public String divide(@RequestParam Integer a, @RequestParam Integer b) { 32 | return String.valueOf(a / b); 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/TestController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import java.util.concurrent.atomic.AtomicInteger; 20 | 21 | import org.springframework.web.bind.annotation.RequestMapping; 22 | import org.springframework.web.bind.annotation.ResponseBody; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author xiaolongzuo 27 | */ 28 | @RestController 29 | public class TestController { 30 | 31 | static AtomicInteger atomicInteger = new AtomicInteger(0); 32 | 33 | @RequestMapping("/test") 34 | @ResponseBody 35 | public String test() { 36 | return String.valueOf(atomicInteger.get()); 37 | } 38 | 39 | } 40 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-seata/src/main/java/com/alibaba/cloud/seata/SeataProperties.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.seata; 18 | 19 | import org.springframework.boot.context.properties.ConfigurationProperties; 20 | 21 | /** 22 | * @author xiaojing 23 | */ 24 | @ConfigurationProperties("spring.cloud.alibaba.seata") 25 | public class SeataProperties { 26 | 27 | // todo support config Fescar server information 28 | 29 | /** 30 | * Seata tx service group.default is ${spring.application.name}-fescar-service-group. 31 | */ 32 | private String txServiceGroup; 33 | 34 | public String getTxServiceGroup() { 35 | return txServiceGroup; 36 | } 37 | 38 | public void setTxServiceGroup(String txServiceGroup) { 39 | this.txServiceGroup = txServiceGroup; 40 | } 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-sentinel/src/main/java/com/alibaba/cloud/sentinel/annotation/SentinelRestTemplate.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.sentinel.annotation; 18 | 19 | import java.lang.annotation.Documented; 20 | import java.lang.annotation.ElementType; 21 | import java.lang.annotation.Retention; 22 | import java.lang.annotation.RetentionPolicy; 23 | import java.lang.annotation.Target; 24 | 25 | /** 26 | * @author fangjian 27 | */ 28 | @Target({ ElementType.METHOD }) 29 | @Retention(RetentionPolicy.RUNTIME) 30 | @Documented 31 | public @interface SentinelRestTemplate { 32 | 33 | String blockHandler() default ""; 34 | 35 | Class blockHandlerClass() default void.class; 36 | 37 | String fallback() default ""; 38 | 39 | Class fallbackClass() default void.class; 40 | 41 | } 42 | -------------------------------------------------------------------------------- /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | jobs: 3 | build: 4 | docker: 5 | - image: springcloud/pipeline-base 6 | user: appuser 7 | environment: 8 | _JAVA_OPTIONS: "-Xms1024m -Xmx2048m" 9 | TERM: dumb 10 | branches: 11 | ignore: 12 | - gh-pages # list of branches to ignore 13 | resource_class: large 14 | steps: 15 | - checkout 16 | - restore_cache: 17 | key: sc-alibaba-{{ .Branch }} 18 | - run: 19 | name: "Download dependencies" 20 | command: ./mvnw -Pspring -U --fail-never dependency:go-offline || true 21 | - save_cache: 22 | key: sc-alibaba-{{ .Branch }} 23 | paths: 24 | - ~/.m2 25 | - run: 26 | name: "Running build" 27 | command: ./mvnw -Pdocs clean install -U -nsu --batch-mode -Dmaven.test.redirectTestOutputToFile=true -Dorg.slf4j.simpleLogger.log.org.apache.maven.cli.transfer.Slf4jMavenTransferListener=warn -Dgpg.skip 28 | - run: 29 | name: "Aggregate test results" 30 | when: always 31 | command: | 32 | mkdir -p ~/junit/ 33 | find . -type f -regex ".*/target/.*-reports/.*" -exec cp {} ~/junit/ \; 34 | bash <(curl -s https://codecov.io/bash) 35 | - store_artifacts: 36 | path: ~/junit/ 37 | destination: artifacts 38 | - store_test_results: 39 | path: ~/junit/ 40 | destination: testartifacts -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/HttpRequestMatcher.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http.matcher; 18 | 19 | import org.springframework.http.HttpRequest; 20 | 21 | /** 22 | * {@link HttpRequest} Matcher 23 | * 24 | * @author Mercy 25 | */ 26 | public interface HttpRequestMatcher { 27 | 28 | /** 29 | * Match {@link HttpRequest} or not 30 | * 31 | * @param request The {@link HttpRequest} instance 32 | * @return if matched, return true, or false. 33 | */ 34 | boolean match(HttpRequest request); 35 | } 36 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/test/java/com/alibaba/cloud/dubbo/http/matcher/AbstractHttpRequestMatcherTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http.matcher; 18 | 19 | import org.junit.Test; 20 | 21 | /** 22 | * {@link AbstractHttpRequestMatcher} Test 23 | * 24 | * @author Mercy 25 | */ 26 | public abstract class AbstractHttpRequestMatcherTest { 27 | 28 | @Test 29 | public abstract void testEqualsAndHashCode(); 30 | 31 | @Test 32 | public abstract void testGetContent(); 33 | 34 | @Test 35 | public abstract void testGetToStringInfix(); 36 | 37 | } 38 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/test/java/com/alibaba/alicloud/context/ans/AnsContextApplicationListenerTests.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.context.ans; 18 | 19 | import static org.assertj.core.api.AssertionsForInterfaceTypes.assertThat; 20 | 21 | import org.junit.Test; 22 | 23 | import com.alibaba.alicloud.context.BaseAliCloudSpringApplication; 24 | 25 | /** 26 | * @author xiaolongzuo 27 | */ 28 | public class AnsContextApplicationListenerTests extends BaseAliCloudSpringApplication { 29 | 30 | @Test 31 | public void testAnsContextApplicationListenerDefault() { 32 | assertThat(System 33 | .getProperty("com.alibaba.ans.shaded.com.taobao.vipserver.serverlist")) 34 | .isEqualTo("192.168.1.100"); 35 | assertThat(System.getProperty("vipserver.server.port")).isEqualTo("8888"); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/MediaTypeExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http.matcher; 18 | 19 | import org.springframework.http.MediaType; 20 | 21 | /** 22 | * A contract for media type expressions (e.g. "text/plain", "!text/plain") as defined in 23 | * the for "consumes" and "produces". 24 | *

25 | * The source code is scratched from 26 | * org.springframework.web.servlet.mvc.condition.MediaTypeExpression 27 | * 28 | * @author Rossen Stoyanchev 29 | */ 30 | interface MediaTypeExpression { 31 | 32 | MediaType getMediaType(); 33 | 34 | boolean isNegated(); 35 | 36 | } 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/src/main/java/com/alibaba/cloud/examples/SimpleTask.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.beans.factory.annotation.Autowired; 20 | 21 | import com.alibaba.edas.schedulerx.ProcessResult; 22 | import com.alibaba.edas.schedulerx.ScxSimpleJobContext; 23 | import com.alibaba.edas.schedulerx.ScxSimpleJobProcessor; 24 | 25 | /** 26 | * @author xiaolongzuo 27 | */ 28 | public class SimpleTask implements ScxSimpleJobProcessor { 29 | 30 | @Autowired 31 | private TestService testService; 32 | 33 | @Override 34 | public ProcessResult process(ScxSimpleJobContext context) { 35 | testService.test(); 36 | ProcessResult processResult = new ProcessResult(true); 37 | return processResult; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/acm-example/acm-local-example/readme-zh.md: -------------------------------------------------------------------------------- 1 | # ACM Local Example 2 | 3 | ## 项目说明 4 | 5 | 本项目展示了,在Spring Cloud规范下,如何以最简单且免费的方式,使用ACM产品,将配置统一管理。 6 | 7 | 应用配置管理(Application Configuration Management,简称 ACM),其前身为淘宝内部配置中心 Diamond,是一款应用配置中心产品。基于该应用配置中心产品,您可以在微服务、DevOps、大数据等场景下极大地减轻配置管理的工作量的同时,保证配置的安全合规。更多 ACM 相关的信息,请参考 [ACM官网](https://www.aliyun.com/product/acm)。 8 | 9 | ## 示例 10 | 11 | ### 准备工作 12 | 13 | ACM支持直接使用免费的轻量版配置中心,进行开发和调试工作。本示例也是基于轻量版配置中心的,因此我们需要首先安装和启动轻量版配置中心。 14 | 15 | 1. [下载轻量版配置中心](https://edas-public.oss-cn-hangzhou.aliyuncs.com/install_package/LCC/2018-11-01/edas-lite-configcenter.tar.gz?file=edas-lite-configcenter.tar.gz) 16 | 17 | 2. 解压 edas-lite-configcenter.tar.gz ,然后执行以下命令。 18 | 19 | cd edas-config-center && sh startup.sh 20 | 21 | 出现以下内容说明轻量版配置中心启动成功。 22 | 23 | Edas-config-center has been started successfully. 24 | You can see more details in logs/config-center.log. 25 | 26 | 3. 进入页面 http://127.0.0.1:8080,在左侧"配置列表"页面中,点击"添加"按钮,添加如下配置。 27 | 28 | Group:DEFAULT_GROUP 29 | DataId:acm-local.properties 30 | Content:user.id=xiaolongzuo 31 | 32 | ### 启动应用 33 | 34 | 直接运行main class,即`AcmApplication`。 35 | 36 | ### 查看效果 37 | 38 | 1. 使用`curl`可以看到在配置中心配置的user.id。 39 | 40 | curl http://127.0.0.1:18089/ 41 | 42 | 2. 进入页面 http://127.0.0.1:8080,在左侧"配置列表"页面中,更改user.id的值以后,再次使用`curl`命令,可以看到配置变化。 43 | 44 | 45 | 如果您对 Spring Cloud ACM Starter 有任何建议或想法,欢迎提交 issue 中或者通过其他社区渠道向我们反馈。 46 | 47 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/main/java/com/alibaba/alicloud/ans/endpoint/AnsEndpointAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans.endpoint; 18 | 19 | import org.springframework.boot.actuate.endpoint.annotation.Endpoint; 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 21 | import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; 22 | import org.springframework.context.annotation.Bean; 23 | 24 | import com.alibaba.alicloud.context.ans.AnsProperties; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | */ 29 | @ConditionalOnWebApplication 30 | @ConditionalOnClass(Endpoint.class) 31 | public class AnsEndpointAutoConfiguration { 32 | 33 | @Bean 34 | public AnsEndpoint ansEndpoint(AnsProperties ansProperties) { 35 | return new AnsEndpoint(ansProperties); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/main/java/com/alibaba/alicloud/ans/ribbon/AnsRibbonClientConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans.ribbon; 18 | 19 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; 20 | import org.springframework.context.annotation.Bean; 21 | import org.springframework.context.annotation.Configuration; 22 | 23 | import com.netflix.client.config.IClientConfig; 24 | import com.netflix.loadbalancer.ServerList; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | * @author pbting 29 | */ 30 | @Configuration 31 | public class AnsRibbonClientConfiguration { 32 | 33 | @Bean 34 | @ConditionalOnMissingBean 35 | public ServerList ansRibbonServerList(IClientConfig config) { 36 | AnsServerList serverList = new AnsServerList(config.getClientName()); 37 | return serverList; 38 | } 39 | 40 | } -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/test/java/com/alibaba/cloud/dubbo/http/util/HttpUtilsTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http.util; 18 | 19 | import org.junit.Assert; 20 | import org.junit.Test; 21 | 22 | /** 23 | * {@link HttpUtils} Test 24 | * 25 | * @author Mercy 26 | */ 27 | public class HttpUtilsTest { 28 | 29 | @Test 30 | public void testEncodeAndDecode() { 31 | 32 | String whitespace = " "; 33 | 34 | String encodedValue = HttpUtils.encode(" "); 35 | 36 | String decodedValue = HttpUtils.decode(encodedValue); 37 | 38 | Assert.assertEquals(whitespace, decodedValue); 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/nacos-example/nacos-discovery-example/nacos-discovery-spring-cloud-config-server/src/main/java/com/alibaba/cloud/examples/SpringCloudConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * https://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.springframework.boot.SpringApplication; 20 | import org.springframework.boot.autoconfigure.SpringBootApplication; 21 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 22 | import org.springframework.cloud.config.server.EnableConfigServer; 23 | 24 | /** 25 | * @author Jim 26 | */ 27 | @SpringBootApplication 28 | @EnableDiscoveryClient 29 | @EnableConfigServer 30 | public class SpringCloudConfigServerApplication { 31 | 32 | public static void main(String[] args) { 33 | SpringApplication.run(SpringCloudConfigServerApplication.class, args); 34 | } 35 | 36 | } -------------------------------------------------------------------------------- /spring-cloud-alicloud-context/src/main/java/com/alibaba/alicloud/context/ans/AnsContextAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.context.ans; 18 | 19 | import org.springframework.boot.autoconfigure.ImportAutoConfiguration; 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 21 | import org.springframework.boot.context.properties.EnableConfigurationProperties; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | import com.alibaba.alicloud.context.edas.EdasContextAutoConfiguration; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | */ 29 | @Configuration 30 | @ConditionalOnClass(name = "com.alibaba.alicloud.ans.AnsAutoConfiguration") 31 | @EnableConfigurationProperties(AnsProperties.class) 32 | @ImportAutoConfiguration(EdasContextAutoConfiguration.class) 33 | public class AnsContextAutoConfiguration { 34 | 35 | } 36 | -------------------------------------------------------------------------------- /spring-cloud-alicloud-ans/src/test/java/com/alibaba/alicloud/ans/test/AnsMockTest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.alicloud.ans.test; 18 | 19 | import java.util.Map; 20 | 21 | import com.alibaba.ans.shaded.com.taobao.vipserver.client.core.Host; 22 | 23 | /** 24 | * @author xiaojing 25 | */ 26 | public class AnsMockTest { 27 | 28 | public static Host hostInstance(String serviceName, boolean valid, 29 | Map metadata) { 30 | Host host = new Host(); 31 | host.setHostname(serviceName); 32 | host.setValid(valid); 33 | return host; 34 | } 35 | 36 | public static Host hostInstance(String serviceName, boolean valid, String ip, 37 | int port, Map metadata) { 38 | Host host = new Host(); 39 | host.setIp(ip); 40 | host.setPort(port); 41 | host.setValid(valid); 42 | host.setHostname(serviceName); 43 | return host; 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/acm-example/acm-local-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | acm-local-example 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alicloud-acm 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-maven-plugin 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-provider-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | ans-provider-example 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alicloud-ans 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-maven-plugin 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/matcher/NameValueExpression.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http.matcher; 18 | 19 | /** 20 | * A contract for {@code "name!=value"} style expression used to specify request 21 | * parameters and request header in HTTP request 22 | *

23 | * The some source code is scratched from 24 | * org.springframework.web.servlet.mvc.condition.NameValueExpression 25 | * 26 | * @param the value type 27 | * @author Rossen Stoyanchev 28 | * @author Mercy 29 | */ 30 | interface NameValueExpression { 31 | 32 | String getName(); 33 | 34 | T getValue(); 35 | 36 | boolean isNegated(); 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/ans-example/ans-consumer-ribbon-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | ans-consumer-ribbon-example 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alicloud-ans 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | 29 | 30 | 31 | org.springframework.boot 32 | spring-boot-maven-plugin 33 | 34 | 35 | 36 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/oss-example/src/main/java/com/alibaba/cloud/examples/OssApplication.java: -------------------------------------------------------------------------------- 1 | package com.alibaba.cloud.examples; 2 | 3 | import java.net.URISyntaxException; 4 | 5 | import org.springframework.beans.factory.annotation.Autowired; 6 | import org.springframework.boot.ApplicationArguments; 7 | import org.springframework.boot.ApplicationRunner; 8 | import org.springframework.boot.SpringApplication; 9 | import org.springframework.boot.autoconfigure.SpringBootApplication; 10 | import org.springframework.context.annotation.Bean; 11 | 12 | import com.aliyun.oss.OSS; 13 | 14 | /** 15 | * OSS Application 16 | * 17 | * @author Jim 18 | */ 19 | @SpringBootApplication 20 | public class OssApplication { 21 | 22 | public static final String BUCKET_NAME = "spring-cloud-alibaba-test"; 23 | 24 | public static void main(String[] args) throws URISyntaxException { 25 | SpringApplication.run(OssApplication.class, args); 26 | } 27 | 28 | @Bean 29 | public AppRunner appRunner() { 30 | return new AppRunner(); 31 | } 32 | 33 | class AppRunner implements ApplicationRunner { 34 | @Autowired 35 | private OSS ossClient; 36 | 37 | @Override 38 | public void run(ApplicationArguments args) throws Exception { 39 | try { 40 | if (!ossClient.doesBucketExist(BUCKET_NAME)) { 41 | ossClient.createBucket(BUCKET_NAME); 42 | } 43 | } 44 | catch (Exception e) { 45 | System.err.println("oss handle bucket error: " + e.getMessage()); 46 | System.exit(-1); 47 | } 48 | } 49 | } 50 | 51 | } 52 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-config/src/main/java/com/alibaba/cloud/nacos/diagnostics/analyzer/NacosConnectionFailureAnalyzer.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos.diagnostics.analyzer; 18 | 19 | import org.springframework.boot.diagnostics.AbstractFailureAnalyzer; 20 | import org.springframework.boot.diagnostics.FailureAnalysis; 21 | 22 | /** 23 | * A {@code FailureAnalyzer} that performs analysis of failures caused by a 24 | * {@code NacosConnectionFailureException}. 25 | * 26 | * @author juven.xuxb 27 | */ 28 | public class NacosConnectionFailureAnalyzer 29 | extends AbstractFailureAnalyzer { 30 | 31 | @Override 32 | protected FailureAnalysis analyze(Throwable rootFailure, 33 | NacosConnectionFailureException cause) { 34 | return new FailureAnalysis("Application failed to connect to Nacos server", 35 | "check your nacos server config", cause); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/schedulerx-example/schedulerx-simple-task-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | schedulerx-simple-task-example 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alicloud-schedulerx 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | 29 | 30 | 31 | 32 | org.springframework.boot 33 | spring-boot-maven-plugin 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/acm-example/acm-local-example/src/main/java/com/alibaba/cloud/examples/EchoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.examples; 18 | 19 | import org.slf4j.Logger; 20 | import org.slf4j.LoggerFactory; 21 | import org.springframework.beans.factory.annotation.Value; 22 | import org.springframework.cloud.context.config.annotation.RefreshScope; 23 | import org.springframework.web.bind.annotation.RequestMapping; 24 | import org.springframework.web.bind.annotation.RestController; 25 | 26 | /** 27 | * @author xiaolongzuo 28 | */ 29 | @RestController 30 | @RefreshScope 31 | public class EchoController { 32 | 33 | private static final Logger LOGGER = LoggerFactory.getLogger(EchoController.class); 34 | 35 | @Value("${user.id}") 36 | private String userId; 37 | 38 | @RequestMapping(value = "/") 39 | public String echo() { 40 | LOGGER.info("User id is " + userId); 41 | return userId; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-nacos-discovery/src/main/java/com/alibaba/cloud/nacos/ribbon/NacosServerIntrospector.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2019 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.nacos.ribbon; 18 | 19 | import java.util.Map; 20 | 21 | import org.springframework.cloud.netflix.ribbon.DefaultServerIntrospector; 22 | 23 | import com.netflix.loadbalancer.Server; 24 | 25 | /** 26 | * @author xiaojing 27 | */ 28 | public class NacosServerIntrospector extends DefaultServerIntrospector { 29 | 30 | @Override 31 | public Map getMetadata(Server server) { 32 | if (server instanceof NacosServer) { 33 | return ((NacosServer) server).getMetadata(); 34 | } 35 | return super.getMetadata(server); 36 | } 37 | 38 | @Override 39 | public boolean isSecure(Server server) { 40 | if (server instanceof NacosServer) { 41 | return Boolean.valueOf(((NacosServer) server).getMetadata().get("secure")); 42 | } 43 | 44 | return super.isSecure(server); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/account-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | account-service 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alibaba-seata 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-jdbc 30 | 31 | 32 | 33 | mysql 34 | mysql-connector-java 35 | 36 | 37 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-dubbo/src/main/java/com/alibaba/cloud/dubbo/http/HttpServerRequest.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Licensed to the Apache Software Foundation (ASF) under one or more 3 | * contributor license agreements. See the NOTICE file distributed with 4 | * this work for additional information regarding copyright ownership. 5 | * The ASF licenses this file to You under the Apache License, Version 2.0 6 | * (the "License"); you may not use this file except in compliance with 7 | * the License. You may obtain a copy of the License at 8 | * 9 | * http://www.apache.org/licenses/LICENSE-2.0 10 | * 11 | * Unless required by applicable law or agreed to in writing, software 12 | * distributed under the License is distributed on an "AS IS" BASIS, 13 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 | * See the License for the specific language governing permissions and 15 | * limitations under the License. 16 | */ 17 | package com.alibaba.cloud.dubbo.http; 18 | 19 | import org.springframework.http.HttpInputMessage; 20 | import org.springframework.http.HttpRequest; 21 | import org.springframework.util.MultiValueMap; 22 | 23 | /** 24 | * HTTP Server Request 25 | * 26 | * @author Mercy 27 | */ 28 | public interface HttpServerRequest extends HttpRequest, HttpInputMessage { 29 | 30 | /** 31 | * Return a path of current HTTP request 32 | * 33 | * @return 34 | */ 35 | String getPath(); 36 | 37 | /** 38 | * Return a map with parsed and decoded query parameter values. 39 | */ 40 | MultiValueMap getQueryParams(); 41 | 42 | } 43 | -------------------------------------------------------------------------------- /spring-cloud-stream-binder-rocketmq/src/main/java/com/alibaba/cloud/stream/binder/rocketmq/config/RocketMQBinderHealthIndicatorAutoConfiguration.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (C) 2018 the original author or authors. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | */ 16 | 17 | package com.alibaba.cloud.stream.binder.rocketmq.config; 18 | 19 | import org.springframework.boot.actuate.endpoint.annotation.Endpoint; 20 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; 21 | import org.springframework.context.annotation.Bean; 22 | import org.springframework.context.annotation.Configuration; 23 | 24 | import com.alibaba.cloud.stream.binder.rocketmq.actuator.RocketMQBinderHealthIndicator; 25 | 26 | /** 27 | * @author Jim 28 | */ 29 | @Configuration 30 | @ConditionalOnClass(Endpoint.class) 31 | public class RocketMQBinderHealthIndicatorAutoConfiguration { 32 | 33 | @Bean 34 | public RocketMQBinderHealthIndicator rocketBinderHealthIndicator() { 35 | return new RocketMQBinderHealthIndicator(); 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /spring-cloud-alibaba-examples/seata-example/order-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | spring-cloud-alibaba-examples 7 | com.alibaba.cloud 8 | 2.1.1.BUILD-SNAPSHOT 9 | ../../pom.xml 10 | 11 | 4.0.0 12 | order-service 13 | 14 | 15 | 16 | com.alibaba.cloud 17 | spring-cloud-starter-alibaba-seata 18 | 19 | 20 | org.springframework.boot 21 | spring-boot-starter-web 22 | 23 | 24 | org.springframework.boot 25 | spring-boot-starter-actuator 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-jdbc 30 | 31 | 32 | 33 | mysql 34 | mysql-connector-java 35 | 36 | 37 | 38 | 39 | --------------------------------------------------------------------------------