├── seata-biz-service ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── registry.conf │ │ │ └── file.conf │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── seata │ │ │ └── seatabizservice │ │ │ ├── SeataBizServiceApplication.java │ │ │ ├── config │ │ │ └── BizConfig.java │ │ │ ├── controller │ │ │ └── BizController.java │ │ │ └── service │ │ │ └── BizService.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── seata │ │ └── seatabizservice │ │ └── SeataBizServiceApplicationTests.java ├── .gitignore └── pom.xml ├── seata-pay-service ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── registry.conf │ │ │ └── file.conf │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── seata │ │ │ └── seatabizservice │ │ │ ├── SeataPayServiceApplication.java │ │ │ ├── service │ │ │ └── PayService.java │ │ │ └── controller │ │ │ └── PayController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── seata │ │ └── seatabizservice │ │ └── SeataBizServiceApplicationTests.java ├── .gitignore └── pom.xml ├── nacos-config-client ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── bootstrap.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── alibaba │ │ │ └── config │ │ │ ├── NacosConfigClientApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryconsumer │ │ └── NacosDiscoveryConsumerApplicationTests.java ├── .gitignore ├── pom.xml └── mvnw.cmd ├── seata-order-service ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── application.yml │ │ │ ├── registry.conf │ │ │ └── file.conf │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── seata │ │ │ └── seatabizservice │ │ │ ├── SeataOrderServiceApplication.java │ │ │ ├── service │ │ │ └── OrderService.java │ │ │ └── controller │ │ │ └── OrderController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── seata │ │ └── seatabizservice │ │ └── SeataBizServiceApplicationTests.java ├── .gitignore └── pom.xml ├── sentinel-core-example ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ ├── flowrule.json │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── sentinel │ │ │ ├── SentinelCoreExampleApplication.java │ │ │ ├── config │ │ │ ├── ExceptionUtil.java │ │ │ ├── SentinelConfig.java │ │ │ ├── IpRequestOriginParser.java │ │ │ └── DemoUrlBlockHandler.java │ │ │ └── controller │ │ │ ├── SecurityController.java │ │ │ ├── ParamController.java │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── sentinelcoreexample │ │ └── SentinelCoreExampleApplicationTests.java ├── .gitignore └── pom.xml ├── sentinel-feign-consumer ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── sentinelfeignprovier │ │ │ ├── feign │ │ │ ├── DemoFeginClientFallback.java │ │ │ └── DemoFeignClient.java │ │ │ ├── SentinelFeignProvierApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── sentinelfeignprovier │ │ └── SentinelFeignProvierApplicationTests.java ├── .gitignore └── pom.xml ├── sentinel-feign-provier ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── sentinelfeignprovier │ │ │ ├── SentinelFeignProvierApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── sentinelfeignprovier │ │ └── SentinelFeignProvierApplicationTests.java ├── .gitignore └── pom.xml ├── nacos-config-client-load ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── bootstrap.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── alibaba │ │ │ └── config │ │ │ ├── NacosConfigLoadClientApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryconsumer │ │ └── NacosDiscoveryConsumerApplicationTests.java ├── .gitignore ├── README.md ├── pom.xml └── mvnw.cmd ├── nacos-discovery-consumer ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── alibaba │ │ │ └── nacosdiscoveryconsumer │ │ │ ├── NacosDiscoveryConsumerApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryconsumer │ │ └── NacosDiscoveryConsumerApplicationTests.java ├── .gitignore ├── pom.xml └── mvnw.cmd ├── nacos-discovery-provider ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── alibaba │ │ │ └── nacosdiscoveryprovider │ │ │ ├── NacosDiscoveryProviderApplication.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryprovider │ │ └── NacosDiscoveryProviderApplicationTests.java ├── .gitignore └── pom.xml ├── nacos-discovery-consumer-feign ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ ├── main │ │ ├── resources │ │ │ └── application.yml │ │ └── java │ │ │ └── com │ │ │ └── pig4cloud │ │ │ └── alibaba │ │ │ └── nacosdiscoveryconsumer │ │ │ ├── NacosDiscoveryConsumerFeignApplication.java │ │ │ ├── service │ │ │ └── DemoFeignService.java │ │ │ └── controller │ │ │ └── DemoController.java │ └── test │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryconsumer │ │ └── NacosDiscoveryConsumerApplicationTests.java ├── .gitignore └── pom.xml ├── nacos-discovery-gateway-server ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── .gitignore ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── gateway │ │ └── NacosDiscoveryGatewagApplication.java └── pom.xml ├── nacos-discovery-consumer-webflux ├── .mvn │ └── wrapper │ │ ├── maven-wrapper.jar │ │ ├── maven-wrapper.properties │ │ └── MavenWrapperDownloader.java ├── src │ └── main │ │ ├── resources │ │ └── application.yml │ │ └── java │ │ └── com │ │ └── pig4cloud │ │ └── alibaba │ │ └── nacosdiscoveryconsumer │ │ ├── NacosDiscoveryConsumerWebFluxApplication.java │ │ └── controller │ │ └── DemoController.java ├── .gitignore └── pom.xml ├── README.md ├── .gitignore └── pom.xml /seata-biz-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/seata-biz-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata-pay-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/seata-pay-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-config-client/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-config-client/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /seata-order-service/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/seata-order-service/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /sentinel-core-example/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/sentinel-core-example/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /sentinel-feign-consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/sentinel-feign-consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /sentinel-feign-provier/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/sentinel-feign-provier/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-config-client-load/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-config-client-load/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-discovery-consumer/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-discovery-consumer/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-discovery-provider/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-discovery-provider/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-config-client/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-discovery-consumer-feign/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-discovery-gateway-server/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-config-client-load/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/.mvn/wrapper/maven-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/lltx/learn-alibaba/HEAD/nacos-discovery-consumer-webflux/.mvn/wrapper/maven-wrapper.jar -------------------------------------------------------------------------------- /nacos-discovery-consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-provider/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.0/apache-maven-3.6.0-bin.zip 2 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 18081 3 | 4 | spring: 5 | application: 6 | name: sentinel-feign-comsumer 7 | cloud: 8 | nacos: 9 | server-addr: localhost:8848 -------------------------------------------------------------------------------- /sentinel-feign-provier/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 18082 3 | 4 | spring: 5 | application: 6 | name: sentinel-feign-provider 7 | cloud: 8 | nacos: 9 | server-addr: localhost:8848 -------------------------------------------------------------------------------- /sentinel-core-example/src/main/resources/flowrule.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "resource": "hello", 4 | "count": 1, 5 | "grade": 1, 6 | "limitApp": "default", 7 | "strategy": 0, 8 | "controlBehavior": 0 9 | } 10 | ] -------------------------------------------------------------------------------- /seata-biz-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /seata-order-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /seata-pay-service/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /sentinel-core-example/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /sentinel-feign-provier/.mvn/wrapper/maven-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.2/apache-maven-3.6.2-bin.zip 2 | wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar 3 | -------------------------------------------------------------------------------- /nacos-discovery-provider/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8051 3 | 4 | spring: 5 | application: 6 | name: nacos-discovery-provider 7 | cloud: 8 | nacos: 9 | discovery: 10 | server-addr: 127.0.0.1:8848 11 | metadata: 12 | name: provider 13 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | 2 | 3 | Spring Cloud Alibaba 作为 Spring Cloud 新的实现之一,是阿里巴巴多年双 11 磨炼下的中间件跟 Spring Cloud 体系所结合诞生的开源项目。本视频详细讲解 Spring Cloud Alibaba 各个组件的功能,可以让开发者对 Spring Cloud 或 Spring Cloud Alibaba 体系有一定的认识。 4 | 5 | 6 | --- 7 | 8 | Spring Cloud Alibaba 系列视频教程源码 9 | 10 | https://bilibili.com/video/av20229859/ 11 | -------------------------------------------------------------------------------- /nacos-config-client/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-config-client 4 | cloud: 5 | nacos: 6 | config: 7 | server-addr: 127.0.0.1:8848 8 | file-extension: yml 9 | profiles: 10 | active: dev 11 | server: 12 | port: 8055 13 | 14 | 15 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-discovery-consumer 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | metadata: 9 | name: lengleng 10 | 11 | server: 12 | port: 8050 13 | 14 | 15 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8010 3 | 4 | spring: 5 | application: 6 | name: biz-service 7 | datasource: 8 | url: jdbc:mysql://localhost:3306/order?useSSL=false 9 | username: root 10 | password: root 11 | driver-class-name: com.mysql.cj.jdbc.Driver 12 | -------------------------------------------------------------------------------- /seata-order-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8020 3 | 4 | spring: 5 | application: 6 | name: order-service 7 | datasource: 8 | url: jdbc:mysql://localhost:3306/order?useSSL=false 9 | username: root 10 | password: root 11 | driver-class-name: com.mysql.cj.jdbc.Driver -------------------------------------------------------------------------------- /seata-pay-service/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | 2 | server: 3 | port: 8030 4 | 5 | spring: 6 | application: 7 | name: pay-service 8 | datasource: 9 | url: jdbc:mysql://localhost:3306/pay?useSSL=false 10 | username: root 11 | password: root 12 | driver-class-name: com.mysql.cj.jdbc.Driver -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-discovery-consumer-feign 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | metadata: 9 | name: lengleng 10 | 11 | server: 12 | port: 8052 13 | 14 | 15 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-discovery-consumer-webflux 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | metadata: 9 | name: lengleng 10 | 11 | server: 12 | port: 8053 13 | 14 | 15 | -------------------------------------------------------------------------------- /seata-biz-service/src/test/java/com/pig4cloud/seata/seatabizservice/SeataBizServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataBizServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata-order-service/src/test/java/com/pig4cloud/seata/seatabizservice/SeataBizServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataBizServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata-pay-service/src/test/java/com/pig4cloud/seata/seatabizservice/SeataBizServiceApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SeataBizServiceApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sentinel-core-example/src/test/java/com/pig4cloud/sentinelcoreexample/SentinelCoreExampleApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelcoreexample; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SentinelCoreExampleApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sentinel-feign-provier/src/test/java/com/pig4cloud/sentinelfeignprovier/SentinelFeignProvierApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SentinelFeignProvierApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/test/java/com/pig4cloud/sentinelfeignprovier/SentinelFeignProvierApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier; 2 | 3 | import org.junit.jupiter.api.Test; 4 | import org.springframework.boot.test.context.SpringBootTest; 5 | 6 | @SpringBootTest 7 | class SentinelFeignProvierApplicationTests { 8 | 9 | @Test 10 | void contextLoads() { 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /nacos-config-client-load/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-config-client-load 4 | cloud: 5 | nacos: 6 | config: 7 | server-addr: 127.0.0.1:8848 8 | file-extension: yml 9 | namespace: b47c4714-f86e-4234-ad21-1e7fe654f5d5 10 | group: PIGX 11 | shared-dataids: common.yml 12 | 13 | 14 | server: 15 | port: 8056 16 | 17 | 18 | -------------------------------------------------------------------------------- /nacos-config-client/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-config-client-load/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-discovery-provider/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | /target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | 5 | ### STS ### 6 | .apt_generated 7 | .classpath 8 | .factorypath 9 | .project 10 | .settings 11 | .springBeans 12 | .sts4-cache 13 | 14 | ### IntelliJ IDEA ### 15 | .idea 16 | *.iws 17 | *.iml 18 | *.ipr 19 | 20 | ### NetBeans ### 21 | /nbproject/private/ 22 | /nbbuild/ 23 | /dist/ 24 | /nbdist/ 25 | /.nb-gradle/ 26 | /build/ 27 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/main/java/com/pig4cloud/sentinelfeignprovier/feign/DemoFeginClientFallback.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier.feign; 2 | 3 | import org.springframework.stereotype.Component; 4 | 5 | /** 6 | * @author lengleng 7 | * @date 2019-12-07 8 | */ 9 | @Component 10 | public class DemoFeginClientFallback implements DemoFeignClient { 11 | @Override 12 | public String feign() { 13 | return "error"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/SentinelCoreExampleApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinel; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class SentinelCoreExampleApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SentinelCoreExampleApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /seata-biz-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /seata-pay-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /seata-order-service/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /sentinel-core-example/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /sentinel-feign-provier/.gitignore: -------------------------------------------------------------------------------- 1 | HELP.md 2 | target/ 3 | !.mvn/wrapper/maven-wrapper.jar 4 | !**/src/main/** 5 | !**/src/test/** 6 | 7 | ### STS ### 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | .sts4-cache 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | 22 | ### NetBeans ### 23 | /nbproject/private/ 24 | /nbbuild/ 25 | /dist/ 26 | /nbdist/ 27 | /.nb-gradle/ 28 | build/ 29 | 30 | ### VS Code ### 31 | .vscode/ 32 | -------------------------------------------------------------------------------- /sentinel-feign-provier/src/main/java/com/pig4cloud/sentinelfeignprovier/SentinelFeignProvierApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.cloud.client.SpringCloudApplication; 5 | 6 | @SpringCloudApplication 7 | public class SentinelFeignProvierApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(SentinelFeignProvierApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /sentinel-feign-provier/src/main/java/com/pig4cloud/sentinelfeignprovier/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier.controller; 2 | 3 | import org.springframework.web.bind.annotation.GetMapping; 4 | import org.springframework.web.bind.annotation.RestController; 5 | 6 | /** 7 | * @author lengleng 8 | * @date 2019-12-07 9 | */ 10 | @RestController 11 | public class DemoController { 12 | 13 | @GetMapping("/feign") 14 | public String feign() { 15 | return "hello sentinel feign"; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/main/java/com/pig4cloud/sentinelfeignprovier/feign/DemoFeignClient.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier.feign; 2 | 3 | import org.springframework.cloud.openfeign.FeignClient; 4 | import org.springframework.web.bind.annotation.GetMapping; 5 | 6 | /** 7 | * @author lengleng 8 | * @date 2019-12-07 9 | */ 10 | @FeignClient(value = "sentinel-feign-provider", fallback = DemoFeginClientFallback.class) 11 | public interface DemoFeignClient { 12 | 13 | @GetMapping("/feign") 14 | String feign(); 15 | } 16 | -------------------------------------------------------------------------------- /nacos-config-client-load/README.md: -------------------------------------------------------------------------------- 1 | ## profile 2 | 3 | 2019-03-03 12:44:29.040 INFO 23952 --- [-127.0.0.1_8848] o.s.c.a.n.c.NacosPropertySourceBuilder : Loading nacos data, dataId: 'nacos-config-client-load.yml', group: 'DEFAULT_GROUP' 4 | 2019-03-03 12:44:29.044 INFO 23952 --- [-127.0.0.1_8848] o.s.c.a.n.c.NacosPropertySourceBuilder : Loading nacos data, dataId: 'nacos-config-client-load-dev.yml', group: 'DEFAULT_GROUP' 5 | 6 | - 优先使用配置是 applicationname-profile 7 | - 不存在时读取 applicationname 8 | 9 | ## GROUP 10 | - 默认没有组 都是放在DEFAULT_GROUP 11 | 12 | ## namespace 13 | -------------------------------------------------------------------------------- /nacos-config-client/src/test/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class NacosDiscoveryConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: nacos-discovery-gateway-server 4 | cloud: 5 | nacos: 6 | discovery: 7 | server-addr: 127.0.0.1:8848 8 | metadata: 9 | name: lengleng 10 | gateway: 11 | routes: 12 | - id: nacos-discovery-provider 13 | uri: lb://nacos-discovery-provider 14 | predicates: 15 | - Path=/provider/** 16 | filters: 17 | - StripPrefix=1 18 | 19 | server: 20 | port: 8054 21 | 22 | 23 | -------------------------------------------------------------------------------- /nacos-config-client-load/src/test/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class NacosDiscoveryConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/src/test/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class NacosDiscoveryConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /nacos-discovery-provider/src/test/java/com/pig4cloud/alibaba/nacosdiscoveryprovider/NacosDiscoveryProviderApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryprovider; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class NacosDiscoveryProviderApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/src/test/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerApplicationTests.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.boot.test.context.SpringBootTest; 6 | import org.springframework.test.context.junit4.SpringRunner; 7 | 8 | @RunWith(SpringRunner.class) 9 | @SpringBootTest 10 | public class NacosDiscoveryConsumerApplicationTests { 11 | 12 | @Test 13 | public void contextLoads() { 14 | } 15 | 16 | } 17 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/main/java/com/pig4cloud/sentinelfeignprovier/SentinelFeignProvierApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.cloud.client.SpringCloudApplication; 5 | import org.springframework.cloud.openfeign.EnableFeignClients; 6 | 7 | @EnableFeignClients 8 | @SpringCloudApplication 9 | public class SentinelFeignProvierApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(SentinelFeignProvierApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /nacos-config-client/src/main/java/com/pig4cloud/alibaba/config/NacosConfigClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.config; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class NacosConfigClientApplication { 10 | 11 | public static void main(String[] args) { 12 | 13 | 14 | SpringApplication.run(NacosConfigClientApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /nacos-config-client-load/src/main/java/com/pig4cloud/alibaba/config/NacosConfigLoadClientApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.config; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class NacosConfigLoadClientApplication { 10 | 11 | public static void main(String[] args) { 12 | 13 | 14 | SpringApplication.run(NacosConfigLoadClientApplication.class, args); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 18080 3 | 4 | spring: 5 | cloud: 6 | sentinel: 7 | transport: 8 | dashboard: localhost:8080 9 | datasource: 10 | ds1: 11 | file: 12 | file: classpath:flowrule.json 13 | data-type: json 14 | rule-type: flow 15 | ds2: 16 | nacos: 17 | server-addr: localhost:8848 18 | dataId: sentinel-core-example 19 | groupId: DEFAULT_GROUP 20 | data-type: json 21 | rule-type: flow 22 | application: 23 | name: sentinel-core-example 24 | -------------------------------------------------------------------------------- /nacos-discovery-provider/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryprovider/NacosDiscoveryProviderApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryprovider; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 6 | 7 | @EnableDiscoveryClient 8 | @SpringBootApplication 9 | public class NacosDiscoveryProviderApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(NacosDiscoveryProviderApplication.class, args); 13 | } 14 | 15 | } 16 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/src/main/java/com/pig4cloud/sentinelfeignprovier/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.sentinelfeignprovier.controller; 2 | 3 | import com.pig4cloud.sentinelfeignprovier.feign.DemoFeignClient; 4 | import org.springframework.beans.factory.annotation.Autowired; 5 | import org.springframework.web.bind.annotation.GetMapping; 6 | import org.springframework.web.bind.annotation.RestController; 7 | 8 | /** 9 | * @author lengleng 10 | * @date 2019-12-07 11 | */ 12 | @RestController 13 | public class DemoController { 14 | @Autowired 15 | private DemoFeignClient feignClient; 16 | 17 | @GetMapping("/hello") 18 | public String hello() { 19 | return feignClient.feign(); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerFeignApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 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.cloud.openfeign.EnableFeignClients; 7 | 8 | @EnableFeignClients 9 | @EnableDiscoveryClient 10 | @SpringBootApplication 11 | public class NacosDiscoveryConsumerFeignApplication { 12 | 13 | public static void main(String[] args) { 14 | 15 | 16 | SpringApplication.run(NacosDiscoveryConsumerFeignApplication.class, args); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ### gradle ### 2 | .gradle 3 | /build/ 4 | !gradle/wrapper/gradle-wrapper.jar 5 | 6 | ### STS ### 7 | .settings/ 8 | .apt_generated 9 | .classpath 10 | .factorypath 11 | .project 12 | .settings 13 | .springBeans 14 | bin/ 15 | 16 | ### IntelliJ IDEA ### 17 | .idea 18 | *.iws 19 | *.iml 20 | *.ipr 21 | rebel.xml 22 | 23 | ### NetBeans ### 24 | nbproject/private/ 25 | build/ 26 | nbbuild/ 27 | dist/ 28 | nbdist/ 29 | .nb-gradle/ 30 | 31 | ### maven ### 32 | target/ 33 | *.war 34 | *.ear 35 | *.zip 36 | *.tar 37 | *.tar.gz 38 | 39 | ### logs #### 40 | /logs/ 41 | *.log 42 | 43 | ### temp ignore ### 44 | *.cache 45 | *.diff 46 | *.patch 47 | *.tmp 48 | *.java~ 49 | *.properties~ 50 | *.xml~ 51 | 52 | ### system ignore ### 53 | .DS_Store 54 | Thumbs.db 55 | Servers 56 | .metadata 57 | upload 58 | gen_code 59 | -------------------------------------------------------------------------------- /seata-order-service/src/main/java/com/pig4cloud/seata/seatabizservice/SeataOrderServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import io.seata.rm.datasource.DataSourceProxy; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.jdbc.core.JdbcTemplate; 8 | 9 | import javax.sql.DataSource; 10 | 11 | 12 | @SpringBootApplication 13 | public class SeataOrderServiceApplication { 14 | 15 | public static void main(String[] args) { 16 | SpringApplication.run(SeataOrderServiceApplication.class, args); 17 | } 18 | 19 | @Bean 20 | public JdbcTemplate jdbcTemplate(DataSource dataSource){ 21 | return new JdbcTemplate(new DataSourceProxy(dataSource)); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/java/com/pig4cloud/seata/seatabizservice/SeataBizServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import io.seata.rm.datasource.DataSourceProxy; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.jdbc.core.JdbcTemplate; 8 | 9 | import javax.sql.DataSource; 10 | 11 | 12 | @SpringBootApplication 13 | public class SeataBizServiceApplication { 14 | 15 | public static void main(String[] args) { 16 | 17 | 18 | SpringApplication.run(SeataBizServiceApplication.class, args); 19 | } 20 | 21 | @Bean 22 | public JdbcTemplate jdbcTemplate(DataSource dataSource) { 23 | return new JdbcTemplate(new DataSourceProxy(dataSource)); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /seata-pay-service/src/main/java/com/pig4cloud/seata/seatabizservice/SeataPayServiceApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.seata.seatabizservice; 2 | 3 | import io.seata.rm.datasource.DataSourceProxy; 4 | import org.springframework.boot.SpringApplication; 5 | import org.springframework.boot.autoconfigure.SpringBootApplication; 6 | import org.springframework.context.annotation.Bean; 7 | import org.springframework.jdbc.core.JdbcTemplate; 8 | 9 | import javax.sql.DataSource; 10 | 11 | 12 | @SpringBootApplication 13 | public class SeataPayServiceApplication { 14 | 15 | public static void main(String[] args) { 16 | 17 | SpringApplication.run(SeataPayServiceApplication.class, args); 18 | } 19 | 20 | 21 | @Bean 22 | public JdbcTemplate jdbcTemplate(DataSource dataSource) { 23 | return new JdbcTemplate(new DataSourceProxy(dataSource)); 24 | } 25 | 26 | } 27 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 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.cloud.client.loadbalancer.LoadBalanced; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.web.client.RestTemplate; 9 | 10 | @EnableDiscoveryClient 11 | @SpringBootApplication 12 | public class NacosDiscoveryConsumerApplication { 13 | 14 | public static void main(String[] args) { 15 | 16 | 17 | SpringApplication.run(NacosDiscoveryConsumerApplication.class, args); 18 | } 19 | 20 | 21 | @Bean 22 | @LoadBalanced 23 | public RestTemplate restTemplate() { 24 | return new RestTemplate(); 25 | } 26 | 27 | } 28 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/NacosDiscoveryConsumerWebFluxApplication.java: -------------------------------------------------------------------------------- 1 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer; 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.cloud.client.loadbalancer.LoadBalanced; 7 | import org.springframework.context.annotation.Bean; 8 | import org.springframework.web.reactive.function.client.WebClient; 9 | 10 | @EnableDiscoveryClient 11 | @SpringBootApplication 12 | public class NacosDiscoveryConsumerWebFluxApplication { 13 | 14 | public static void main(String[] args) { 15 | SpringApplication.run(NacosDiscoveryConsumerWebFluxApplication.class, args); 16 | } 17 | 18 | 19 | @Bean 20 | @LoadBalanced 21 | public WebClient.Builder webClientBuilder() { 22 | return WebClient.builder(); 23 | } 24 | 25 | 26 | } 27 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/config/ExceptionUtil.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.config; 19 | 20 | import com.alibaba.csp.sentinel.slots.block.BlockException; 21 | 22 | /** 23 | * @author lengleng 24 | * @date 2019-12-04 25 | */ 26 | public class ExceptionUtil { 27 | public static String exHandler(BlockException ex) { 28 | return "exHandler error"; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/java/com/pig4cloud/seata/seatabizservice/config/BizConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.config; 19 | 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 lengleng 26 | * @date 2019-12-30 27 | */ 28 | @Configuration 29 | public class BizConfig { 30 | 31 | @Bean 32 | public RestTemplate restTemplate() { 33 | return new RestTemplate(); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/service/DemoFeignService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer.service; 19 | 20 | import org.springframework.cloud.openfeign.FeignClient; 21 | import org.springframework.web.bind.annotation.GetMapping; 22 | import org.springframework.web.bind.annotation.RequestParam; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2019-03-02 27 | */ 28 | @FeignClient("nacos-discovery-provider") 29 | public interface DemoFeignService { 30 | @GetMapping("/demo") 31 | String demo(@RequestParam("name") String name); 32 | } 33 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/src/main/java/com/pig4cloud/alibaba/gateway/NacosDiscoveryGatewagApplication.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.gateway; 19 | 20 | import org.springframework.boot.SpringApplication; 21 | import org.springframework.boot.autoconfigure.SpringBootApplication; 22 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient; 23 | 24 | @EnableDiscoveryClient 25 | @SpringBootApplication 26 | public class NacosDiscoveryGatewagApplication { 27 | 28 | public static void main(String[] args) { 29 | 30 | 31 | SpringApplication.run(NacosDiscoveryGatewagApplication.class, args); 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/controller/SecurityController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.controller; 19 | 20 | import org.springframework.web.bind.annotation.GetMapping; 21 | import org.springframework.web.bind.annotation.RestController; 22 | 23 | /** 24 | * @author lengleng 25 | * @date 2019-12-04 26 | */ 27 | @RestController 28 | public class SecurityController { 29 | 30 | @GetMapping("/white") 31 | public String white() { 32 | return "hello white"; 33 | } 34 | 35 | @GetMapping("/black") 36 | public String black() { 37 | return "hello black"; 38 | } 39 | 40 | 41 | } 42 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/config/SentinelConfig.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.config; 19 | 20 | import com.alibaba.csp.sentinel.adapter.servlet.callback.WebCallbackManager; 21 | import org.springframework.context.annotation.Configuration; 22 | 23 | import javax.annotation.PostConstruct; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-04 28 | */ 29 | @Configuration 30 | public class SentinelConfig { 31 | 32 | @PostConstruct 33 | public void init() { 34 | WebCallbackManager.setUrlBlockHandler(new DemoUrlBlockHandler()); 35 | WebCallbackManager.setRequestOriginParser(new IpRequestOriginParser()); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /nacos-discovery-provider/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryprovider/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.nacosdiscoveryprovider.controller; 19 | 20 | import org.springframework.beans.factory.annotation.Value; 21 | import org.springframework.web.bind.annotation.GetMapping; 22 | import org.springframework.web.bind.annotation.RestController; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2019-03-01 27 | */ 28 | @RestController 29 | public class DemoController { 30 | @Value("${server.port}") 31 | private Integer port; 32 | 33 | @GetMapping("/demo") 34 | public String demo(String name) { 35 | return "hello " + name + port; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /seata-pay-service/src/main/java/com/pig4cloud/seata/seatabizservice/service/PayService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.service; 19 | 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.jdbc.core.JdbcTemplate; 22 | import org.springframework.stereotype.Service; 23 | import org.springframework.transaction.annotation.Transactional; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-30 28 | */ 29 | @Service 30 | public class PayService { 31 | @Autowired 32 | JdbcTemplate jdbcTemplate; 33 | 34 | @Transactional 35 | public void save() { 36 | jdbcTemplate.update("INSERT INTO `pay`( `username`) VALUES ('123');"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/config/IpRequestOriginParser.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.config; 19 | 20 | import com.alibaba.csp.sentinel.adapter.servlet.callback.RequestOriginParser; 21 | 22 | import javax.servlet.http.HttpServletRequest; 23 | 24 | /** 25 | * @author lengleng 26 | * @date 2019-12-05 27 | */ 28 | public class IpRequestOriginParser implements RequestOriginParser { 29 | /** 30 | * Parse the origin from given HTTP request. 31 | * 32 | * @param request HTTP request 33 | * @return parsed origin 34 | */ 35 | @Override 36 | public String parseOrigin(HttpServletRequest request) { 37 | return request.getRemoteAddr(); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /seata-order-service/src/main/java/com/pig4cloud/seata/seatabizservice/service/OrderService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.service; 19 | 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.jdbc.core.JdbcTemplate; 22 | import org.springframework.stereotype.Service; 23 | import org.springframework.transaction.annotation.Transactional; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-30 28 | */ 29 | @Service 30 | public class OrderService { 31 | @Autowired 32 | JdbcTemplate jdbcTemplate; 33 | 34 | @Transactional 35 | public void save() { 36 | jdbcTemplate.update("INSERT INTO `order`( `username`) VALUES ('123');"); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /nacos-config-client/src/main/java/com/pig4cloud/alibaba/config/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.config.controller; 19 | 20 | import org.springframework.beans.factory.annotation.Value; 21 | import org.springframework.cloud.context.config.annotation.RefreshScope; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-03-03 28 | */ 29 | @RefreshScope 30 | @RestController 31 | public class DemoController { 32 | @Value("${test:空test}") 33 | public String str; 34 | 35 | @GetMapping("/test/config") 36 | public String test() { 37 | return str; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /nacos-config-client-load/src/main/java/com/pig4cloud/alibaba/config/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.config.controller; 19 | 20 | import org.springframework.beans.factory.annotation.Value; 21 | import org.springframework.cloud.context.config.annotation.RefreshScope; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-03-03 28 | */ 29 | @RefreshScope 30 | @RestController 31 | public class DemoController { 32 | @Value("${test:空test}") 33 | public String str; 34 | 35 | @GetMapping("/test/config") 36 | public String test() { 37 | return str; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/java/com/pig4cloud/seata/seatabizservice/controller/BizController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.controller; 19 | 20 | import com.pig4cloud.seata.seatabizservice.service.BizService; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-30 28 | */ 29 | @RestController 30 | public class BizController { 31 | @Autowired 32 | private BizService bizService; 33 | 34 | @GetMapping("/biz") 35 | public String biz() { 36 | bizService.biz(); 37 | return "success"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /seata-pay-service/src/main/java/com/pig4cloud/seata/seatabizservice/controller/PayController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.controller; 19 | 20 | import com.pig4cloud.seata.seatabizservice.service.PayService; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-30 28 | */ 29 | @RestController 30 | public class PayController { 31 | @Autowired 32 | private PayService payService; 33 | 34 | @GetMapping("/pay") 35 | public String order() { 36 | payService.save(); 37 | return "success"; 38 | } 39 | 40 | } 41 | -------------------------------------------------------------------------------- /seata-order-service/src/main/java/com/pig4cloud/seata/seatabizservice/controller/OrderController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.controller; 19 | 20 | import com.pig4cloud.seata.seatabizservice.service.OrderService; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-30 28 | */ 29 | @RestController 30 | public class OrderController { 31 | @Autowired 32 | private OrderService orderService; 33 | 34 | @GetMapping("/order") 35 | public String order() { 36 | orderService.save(); 37 | return "success"; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/config/DemoUrlBlockHandler.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.config; 19 | 20 | import com.alibaba.csp.sentinel.adapter.servlet.callback.UrlBlockHandler; 21 | import com.alibaba.csp.sentinel.slots.block.BlockException; 22 | 23 | import javax.servlet.http.HttpServletRequest; 24 | import javax.servlet.http.HttpServletResponse; 25 | import java.io.IOException; 26 | 27 | /** 28 | * @author lengleng 29 | * @date 2019-12-04 30 | */ 31 | public class DemoUrlBlockHandler implements UrlBlockHandler { 32 | @Override 33 | public void blocked(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, BlockException e) throws IOException { 34 | httpServletResponse.getWriter().println("error url"); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/controller/ParamController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.controller; 19 | 20 | import com.alibaba.csp.sentinel.annotation.SentinelResource; 21 | import com.alibaba.csp.sentinel.slots.block.BlockException; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-05 28 | */ 29 | @RestController 30 | public class ParamController { 31 | @GetMapping("/param") 32 | @SentinelResource 33 | public String param(String type) { 34 | return "success"; 35 | } 36 | 37 | public String exHandler(String type, BlockException ex) { 38 | return "exHandler error"; 39 | } 40 | 41 | } 42 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer.controller; 19 | 20 | import com.pig4cloud.alibaba.nacosdiscoveryconsumer.service.DemoFeignService; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-03-01 28 | */ 29 | @RestController 30 | public class DemoController { 31 | @Autowired 32 | private DemoFeignService demoFeignService; 33 | 34 | @GetMapping("/test") 35 | public String test(String name) { 36 | return demoFeignService.demo(name); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/resources/registry.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa 3 | type = "file" 4 | 5 | nacos { 6 | serverAddr = "localhost" 7 | namespace = "" 8 | cluster = "default" 9 | } 10 | eureka { 11 | serviceUrl = "http://localhost:8761/eureka" 12 | application = "default" 13 | weight = "1" 14 | } 15 | redis { 16 | serverAddr = "localhost:6379" 17 | db = "0" 18 | } 19 | zk { 20 | cluster = "default" 21 | serverAddr = "127.0.0.1:2181" 22 | session.timeout = 6000 23 | connect.timeout = 2000 24 | } 25 | consul { 26 | cluster = "default" 27 | serverAddr = "127.0.0.1:8500" 28 | } 29 | etcd3 { 30 | cluster = "default" 31 | serverAddr = "http://localhost:2379" 32 | } 33 | sofa { 34 | serverAddr = "127.0.0.1:9603" 35 | application = "default" 36 | region = "DEFAULT_ZONE" 37 | datacenter = "DefaultDataCenter" 38 | cluster = "default" 39 | group = "SEATA_GROUP" 40 | addressWaitTime = "3000" 41 | } 42 | file { 43 | name = "file.conf" 44 | } 45 | } 46 | 47 | config { 48 | # file、nacos 、apollo、zk、consul、etcd3 49 | type = "file" 50 | 51 | nacos { 52 | serverAddr = "localhost" 53 | namespace = "" 54 | } 55 | consul { 56 | serverAddr = "127.0.0.1:8500" 57 | } 58 | apollo { 59 | app.id = "seata-server" 60 | apollo.meta = "http://192.168.1.204:8801" 61 | } 62 | zk { 63 | serverAddr = "127.0.0.1:2181" 64 | session.timeout = 6000 65 | connect.timeout = 2000 66 | } 67 | etcd3 { 68 | serverAddr = "http://localhost:2379" 69 | } 70 | file { 71 | name = "file.conf" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /seata-order-service/src/main/resources/registry.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa 3 | type = "file" 4 | 5 | nacos { 6 | serverAddr = "localhost" 7 | namespace = "" 8 | cluster = "default" 9 | } 10 | eureka { 11 | serviceUrl = "http://localhost:8761/eureka" 12 | application = "default" 13 | weight = "1" 14 | } 15 | redis { 16 | serverAddr = "localhost:6379" 17 | db = "0" 18 | } 19 | zk { 20 | cluster = "default" 21 | serverAddr = "127.0.0.1:2181" 22 | session.timeout = 6000 23 | connect.timeout = 2000 24 | } 25 | consul { 26 | cluster = "default" 27 | serverAddr = "127.0.0.1:8500" 28 | } 29 | etcd3 { 30 | cluster = "default" 31 | serverAddr = "http://localhost:2379" 32 | } 33 | sofa { 34 | serverAddr = "127.0.0.1:9603" 35 | application = "default" 36 | region = "DEFAULT_ZONE" 37 | datacenter = "DefaultDataCenter" 38 | cluster = "default" 39 | group = "SEATA_GROUP" 40 | addressWaitTime = "3000" 41 | } 42 | file { 43 | name = "file.conf" 44 | } 45 | } 46 | 47 | config { 48 | # file、nacos 、apollo、zk、consul、etcd3 49 | type = "file" 50 | 51 | nacos { 52 | serverAddr = "localhost" 53 | namespace = "" 54 | } 55 | consul { 56 | serverAddr = "127.0.0.1:8500" 57 | } 58 | apollo { 59 | app.id = "seata-server" 60 | apollo.meta = "http://192.168.1.204:8801" 61 | } 62 | zk { 63 | serverAddr = "127.0.0.1:2181" 64 | session.timeout = 6000 65 | connect.timeout = 2000 66 | } 67 | etcd3 { 68 | serverAddr = "http://localhost:2379" 69 | } 70 | file { 71 | name = "file.conf" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /seata-pay-service/src/main/resources/registry.conf: -------------------------------------------------------------------------------- 1 | registry { 2 | # file 、nacos 、eureka、redis、zk、consul、etcd3、sofa 3 | type = "file" 4 | 5 | nacos { 6 | serverAddr = "localhost" 7 | namespace = "" 8 | cluster = "default" 9 | } 10 | eureka { 11 | serviceUrl = "http://localhost:8761/eureka" 12 | application = "default" 13 | weight = "1" 14 | } 15 | redis { 16 | serverAddr = "localhost:6379" 17 | db = "0" 18 | } 19 | zk { 20 | cluster = "default" 21 | serverAddr = "127.0.0.1:2181" 22 | session.timeout = 6000 23 | connect.timeout = 2000 24 | } 25 | consul { 26 | cluster = "default" 27 | serverAddr = "127.0.0.1:8500" 28 | } 29 | etcd3 { 30 | cluster = "default" 31 | serverAddr = "http://localhost:2379" 32 | } 33 | sofa { 34 | serverAddr = "127.0.0.1:9603" 35 | application = "default" 36 | region = "DEFAULT_ZONE" 37 | datacenter = "DefaultDataCenter" 38 | cluster = "default" 39 | group = "SEATA_GROUP" 40 | addressWaitTime = "3000" 41 | } 42 | file { 43 | name = "file.conf" 44 | } 45 | } 46 | 47 | config { 48 | # file、nacos 、apollo、zk、consul、etcd3 49 | type = "file" 50 | 51 | nacos { 52 | serverAddr = "localhost" 53 | namespace = "" 54 | } 55 | consul { 56 | serverAddr = "127.0.0.1:8500" 57 | } 58 | apollo { 59 | app.id = "seata-server" 60 | apollo.meta = "http://192.168.1.204:8801" 61 | } 62 | zk { 63 | serverAddr = "127.0.0.1:2181" 64 | session.timeout = 6000 65 | connect.timeout = 2000 66 | } 67 | etcd3 { 68 | serverAddr = "http://localhost:2379" 69 | } 70 | file { 71 | name = "file.conf" 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /sentinel-core-example/src/main/java/com/pig4cloud/sentinel/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.sentinel.controller; 19 | 20 | import com.alibaba.csp.sentinel.annotation.SentinelResource; 21 | import com.pig4cloud.sentinel.config.ExceptionUtil; 22 | import org.springframework.web.bind.annotation.GetMapping; 23 | import org.springframework.web.bind.annotation.RestController; 24 | 25 | /** 26 | * @author lengleng 27 | * @date 2019-12-04 28 | */ 29 | @RestController 30 | public class DemoController { 31 | 32 | @GetMapping("/hello") 33 | public String hello() { 34 | return "hello sentinel"; 35 | } 36 | 37 | @GetMapping("/resource") 38 | @SentinelResource(value = "hello2", blockHandler = "exHandler", blockHandlerClass = {ExceptionUtil.class}) 39 | public String resource() { 40 | return "hello resource"; 41 | } 42 | 43 | 44 | } 45 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/java/com/pig4cloud/seata/seatabizservice/service/BizService.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.seata.seatabizservice.service; 19 | 20 | import io.seata.spring.annotation.GlobalTransactional; 21 | import org.springframework.beans.factory.annotation.Autowired; 22 | import org.springframework.stereotype.Service; 23 | import org.springframework.transaction.annotation.Transactional; 24 | import org.springframework.web.client.RestTemplate; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2019-12-30 29 | */ 30 | @Service 31 | public class BizService { 32 | @Autowired 33 | private RestTemplate restTemplate; 34 | 35 | @GlobalTransactional 36 | @Transactional 37 | public void biz() { 38 | restTemplate.getForObject("http://localhost:8020/order", String.class); 39 | restTemplate.getForObject("http://localhost:8030/pay", String.class); 40 | 41 | int i = 1 / 0; 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer.controller; 19 | 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.web.bind.annotation.GetMapping; 22 | import org.springframework.web.bind.annotation.RestController; 23 | import org.springframework.web.reactive.function.client.WebClient; 24 | import reactor.core.publisher.Mono; 25 | 26 | /** 27 | * @author lengleng 28 | * @date 2019-03-01 29 | */ 30 | @RestController 31 | public class DemoController { 32 | @Autowired 33 | private WebClient.Builder webclientBuilder; 34 | 35 | @GetMapping("/test") 36 | public Mono test(String name) { 37 | return webclientBuilder.build() 38 | .get() 39 | .uri("http://nacos-discovery-provider/demo?name=" + name) 40 | .retrieve() 41 | .bodyToMono(String.class); 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 18 | 19 | 22 | 4.0.0 23 | 24 | com.pig4cloud.alibaba 25 | learn-alibaba 26 | 1.0 27 | pom 28 | 29 | 30 | nacos-discovery-provider 31 | nacos-discovery-consumer 32 | nacos-discovery-consumer-feign 33 | nacos-discovery-consumer-webflux 34 | nacos-discovery-gateway-server 35 | 36 | nacos-config-client 37 | nacos-config-client-load 38 | 39 | sentinel-core-example 40 | sentinel-feign-provier 41 | sentinel-feign-consumer 42 | 43 | seata-biz-service 44 | seata-order-service 45 | seata-pay-service 46 | 47 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/src/main/java/com/pig4cloud/alibaba/nacosdiscoveryconsumer/controller/DemoController.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2018-2025, lengleng All rights reserved. 3 | * 4 | * Redistribution and use in source and binary forms, with or without 5 | * modification, are permitted provided that the following conditions are met: 6 | * 7 | * Redistributions of source code must retain the above copyright notice, 8 | * this list of conditions and the following disclaimer. 9 | * Redistributions in binary form must reproduce the above copyright 10 | * notice, this list of conditions and the following disclaimer in the 11 | * documentation and/or other materials provided with the distribution. 12 | * Neither the name of the pig4cloud.com developer nor the names of its 13 | * contributors may be used to endorse or promote products derived from 14 | * this software without specific prior written permission. 15 | * Author: lengleng (wangiegie@gmail.com) 16 | */ 17 | 18 | package com.pig4cloud.alibaba.nacosdiscoveryconsumer.controller; 19 | 20 | import org.springframework.beans.factory.annotation.Autowired; 21 | import org.springframework.cloud.alibaba.nacos.ribbon.NacosServer; 22 | import org.springframework.cloud.client.loadbalancer.LoadBalancerClient; 23 | import org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient; 24 | import org.springframework.web.bind.annotation.GetMapping; 25 | import org.springframework.web.bind.annotation.RestController; 26 | import org.springframework.web.client.RestTemplate; 27 | 28 | /** 29 | * @author lengleng 30 | * @date 2019-03-01 31 | */ 32 | @RestController 33 | public class DemoController { 34 | @Autowired 35 | private RestTemplate restTemplate; 36 | @Autowired 37 | private LoadBalancerClient loadBalancerClient; 38 | 39 | @GetMapping("/test") 40 | public String test(String name) { 41 | RibbonLoadBalancerClient.RibbonServer ribbonServer = (RibbonLoadBalancerClient.RibbonServer) loadBalancerClient.choose("nacos-discovery-provider"); 42 | NacosServer nacosServer = (NacosServer) ribbonServer.getServer(); 43 | System.out.println("-->" + nacosServer.getMetadata()); 44 | return restTemplate.getForObject( "http://nacos-discovery-provider/demo?name=" + name, String.class); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /sentinel-core-example/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.1.RELEASE 9 | 10 | 11 | com.pig4cloud 12 | sentinel-core-example 13 | 0.0.1-SNAPSHOT 14 | sentinel-core-example 15 | sentinel spring boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.boot 24 | spring-boot-starter-web 25 | 26 | 27 | 28 | com.alibaba.cloud 29 | spring-cloud-starter-alibaba-sentinel 30 | 2.1.1.RELEASE 31 | 32 | 33 | 34 | com.alibaba.csp 35 | sentinel-datasource-nacos 36 | 1.7.0 37 | 38 | 39 | 40 | org.springframework.boot 41 | spring-boot-starter-test 42 | test 43 | 44 | 45 | org.junit.vintage 46 | junit-vintage-engine 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.springframework.boot 56 | spring-boot-maven-plugin 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-discovery-consumer-webflux 13 | 0.0.1-SNAPSHOT 14 | nacos-discovery-consumer-webflux 15 | nacos 服务消费方 webflux 调用 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-webflux 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | org.springframework.cloud 38 | spring-cloud-dependencies 39 | Greenwich.RELEASE 40 | pom 41 | import 42 | 43 | 44 | org.springframework.cloud 45 | spring-cloud-alibaba-dependencies 46 | 0.2.1.RELEASE 47 | pom 48 | import 49 | 50 | 51 | 52 | 53 | 54 | 55 | org.springframework.boot 56 | spring-boot-maven-plugin 57 | 58 | 59 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-discovery-gateway-server 13 | 0.0.1-SNAPSHOT 14 | nacos-discovery-gateway-server 15 | nacos 整合spring cloud gateway 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | org.springframework.cloud 29 | spring-cloud-starter-gateway 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | org.springframework.cloud 39 | spring-cloud-dependencies 40 | Greenwich.RELEASE 41 | pom 42 | import 43 | 44 | 45 | org.springframework.cloud 46 | spring-cloud-alibaba-dependencies 47 | 0.2.1.RELEASE 48 | pom 49 | import 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-maven-plugin 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /nacos-config-client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-config-client 13 | 0.0.1-SNAPSHOT 14 | nacos-dconfig-client 15 | nacos 配置中心 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-config 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.springframework.cloud 44 | spring-cloud-dependencies 45 | Greenwich.RELEASE 46 | pom 47 | import 48 | 49 | 50 | org.springframework.cloud 51 | spring-cloud-alibaba-dependencies 52 | 0.2.1.RELEASE 53 | pom 54 | import 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /nacos-discovery-provider/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-discovery-provider 13 | 0.0.1-SNAPSHOT 14 | nacos-discovery-provider 15 | nacos 服务提供方 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | 40 | 41 | 42 | org.springframework.cloud 43 | spring-cloud-dependencies 44 | Greenwich.RELEASE 45 | pom 46 | import 47 | 48 | 49 | org.springframework.cloud 50 | spring-cloud-alibaba-dependencies 51 | 0.2.1.RELEASE 52 | pom 53 | import 54 | 55 | 56 | 57 | 58 | 59 | 60 | org.springframework.boot 61 | spring-boot-maven-plugin 62 | 63 | 64 | 65 | 66 | 67 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-discovery-consumer 13 | 0.0.1-SNAPSHOT 14 | nacos-discovery-consumer 15 | nacos 服务消费方 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.springframework.cloud 44 | spring-cloud-dependencies 45 | Greenwich.RELEASE 46 | pom 47 | import 48 | 49 | 50 | org.springframework.cloud 51 | spring-cloud-alibaba-dependencies 52 | 0.2.1.RELEASE 53 | pom 54 | import 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /nacos-config-client-load/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-config-client-load 13 | 0.0.1-SNAPSHOT 14 | nacos-dconfig-client-load 15 | nacos 配置中心加载顺序 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-config 25 | 26 | 27 | 28 | org.springframework.boot 29 | spring-boot-starter-web 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-test 35 | test 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | org.springframework.cloud 44 | spring-cloud-dependencies 45 | Greenwich.RELEASE 46 | pom 47 | import 48 | 49 | 50 | org.springframework.cloud 51 | spring-cloud-alibaba-dependencies 52 | 0.2.1.RELEASE 53 | pom 54 | import 55 | 56 | 57 | 58 | 59 | 60 | 61 | org.springframework.boot 62 | spring-boot-maven-plugin 63 | 64 | 65 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /seata-pay-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.pig4cloud.seata 12 | seata-pay-service 13 | 0.0.1-SNAPSHOT 14 | seata-pay-service 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | com.alibaba.cloud 24 | spring-cloud-starter-alibaba-seata 25 | 2.1.1.RELEASE 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-jdbc 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-web 35 | 36 | 37 | 38 | mysql 39 | mysql-connector-java 40 | runtime 41 | 42 | 43 | org.projectlombok 44 | lombok 45 | true 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | org.junit.vintage 54 | junit-vintage-engine 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /seata-biz-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.pig4cloud.seata 12 | seata-biz-service 13 | 0.0.1-SNAPSHOT 14 | seata-biz-service 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | 24 | com.alibaba.cloud 25 | spring-cloud-starter-alibaba-seata 26 | 2.1.1.RELEASE 27 | 28 | 29 | 30 | org.springframework.boot 31 | spring-boot-starter-jdbc 32 | 33 | 34 | org.springframework.boot 35 | spring-boot-starter-web 36 | 37 | 38 | 39 | mysql 40 | mysql-connector-java 41 | runtime 42 | 43 | 44 | org.projectlombok 45 | lombok 46 | true 47 | 48 | 49 | org.springframework.boot 50 | spring-boot-starter-test 51 | test 52 | 53 | 54 | org.junit.vintage 55 | junit-vintage-engine 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | org.springframework.boot 65 | spring-boot-maven-plugin 66 | 67 | 68 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /seata-order-service/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.pig4cloud.seata 12 | seata-order-service 13 | 0.0.1-SNAPSHOT 14 | seata-order-service 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | com.alibaba.cloud 24 | spring-cloud-starter-alibaba-seata 25 | 2.1.1.RELEASE 26 | 27 | 28 | 29 | org.springframework.boot 30 | spring-boot-starter-jdbc 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-web 35 | 36 | 37 | 38 | mysql 39 | mysql-connector-java 40 | runtime 41 | 42 | 43 | org.projectlombok 44 | lombok 45 | true 46 | 47 | 48 | org.springframework.boot 49 | spring-boot-starter-test 50 | test 51 | 52 | 53 | org.junit.vintage 54 | junit-vintage-engine 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | org.springframework.boot 64 | spring-boot-maven-plugin 65 | 66 | 67 | 68 | 69 | 70 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.1.3.RELEASE 9 | 10 | 11 | com.pig4cloud.alibaba 12 | nacos-discovery-consumer-feign 13 | 0.0.1-SNAPSHOT 14 | nacos-discovery-consumer-feign 15 | nacos 服务消费方 使用feign 客户端调用 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | org.springframework.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | org.springframework.cloud 29 | spring-cloud-starter-openfeign 30 | 31 | 32 | 33 | org.springframework.boot 34 | spring-boot-starter-web 35 | 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-test 40 | test 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | org.springframework.cloud 49 | spring-cloud-dependencies 50 | Greenwich.RELEASE 51 | pom 52 | import 53 | 54 | 55 | org.springframework.cloud 56 | spring-cloud-alibaba-dependencies 57 | 0.2.1.RELEASE 58 | pom 59 | import 60 | 61 | 62 | 63 | 64 | 65 | 66 | org.springframework.boot 67 | spring-boot-maven-plugin 68 | 69 | 70 | 71 | 72 | 73 | -------------------------------------------------------------------------------- /sentinel-feign-provier/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.pig4cloud 12 | sentinel-feign-provier 13 | 0.0.1-SNAPSHOT 14 | sentinel-feign-provier 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | com.alibaba.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | com.alibaba.cloud 29 | spring-cloud-starter-alibaba-sentinel 30 | 31 | 32 | 33 | org.springframework.cloud 34 | spring-cloud-starter-openfeign 35 | 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-web 40 | 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | org.junit.vintage 49 | junit-vintage-engine 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.cloud 60 | spring-cloud-dependencies 61 | Hoxton.RELEASE 62 | pom 63 | import 64 | 65 | 66 | com.alibaba.cloud 67 | spring-cloud-alibaba-dependencies 68 | 2.1.1.RELEASE 69 | pom 70 | import 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | org.springframework.boot 79 | spring-boot-maven-plugin 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.springframework.boot 7 | spring-boot-starter-parent 8 | 2.2.2.RELEASE 9 | 10 | 11 | com.pig4cloud 12 | sentinel-feign-consumer 13 | 0.0.1-SNAPSHOT 14 | sentinel-feign-consumer 15 | Demo project for Spring Boot 16 | 17 | 18 | 1.8 19 | 20 | 21 | 22 | 23 | com.alibaba.cloud 24 | spring-cloud-starter-alibaba-nacos-discovery 25 | 26 | 27 | 28 | com.alibaba.cloud 29 | spring-cloud-starter-alibaba-sentinel 30 | 31 | 32 | 33 | org.springframework.cloud 34 | spring-cloud-starter-openfeign 35 | 36 | 37 | 38 | org.springframework.boot 39 | spring-boot-starter-web 40 | 41 | 42 | 43 | org.springframework.boot 44 | spring-boot-starter-test 45 | test 46 | 47 | 48 | org.junit.vintage 49 | junit-vintage-engine 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | org.springframework.cloud 60 | spring-cloud-dependencies 61 | Hoxton.RELEASE 62 | pom 63 | import 64 | 65 | 66 | com.alibaba.cloud 67 | spring-cloud-alibaba-dependencies 68 | 2.1.1.RELEASE 69 | pom 70 | import 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | org.springframework.boot 79 | spring-boot-maven-plugin 80 | 81 | 82 | 83 | 84 | 85 | -------------------------------------------------------------------------------- /seata-biz-service/src/main/resources/file.conf: -------------------------------------------------------------------------------- 1 | transport { 2 | # tcp udt unix-domain-socket 3 | type = "TCP" 4 | #NIO NATIVE 5 | server = "NIO" 6 | #enable heartbeat 7 | heartbeat = true 8 | #thread factory for netty 9 | thread-factory { 10 | boss-thread-prefix = "NettyBoss" 11 | worker-thread-prefix = "NettyServerNIOWorker" 12 | server-executor-thread-prefix = "NettyServerBizHandler" 13 | share-boss-worker = false 14 | client-selector-thread-prefix = "NettyClientSelector" 15 | client-selector-thread-size = 1 16 | client-worker-thread-prefix = "NettyClientWorkerThread" 17 | # netty boss thread size,will not be used for UDT 18 | boss-thread-size = 1 19 | #auto default pin or 8 20 | worker-thread-size = 8 21 | } 22 | shutdown { 23 | # when destroy server, wait seconds 24 | wait = 3 25 | } 26 | serialization = "seata" 27 | compressor = "none" 28 | } 29 | service { 30 | #vgroup->rgroup 31 | vgroup_mapping.biz-service-seata-service-group = "default" 32 | #only support single node 33 | default.grouplist = "127.0.0.1:8091" 34 | #degrade current not support 35 | enableDegrade = false 36 | #disable 37 | disable = false 38 | #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent 39 | max.commit.retry.timeout = "-1" 40 | max.rollback.retry.timeout = "-1" 41 | } 42 | 43 | client { 44 | async.commit.buffer.limit = 10000 45 | lock { 46 | retry.internal = 10 47 | retry.times = 30 48 | } 49 | report.retry.count = 5 50 | tm.commit.retry.count = 1 51 | tm.rollback.retry.count = 1 52 | } 53 | 54 | ## transaction log store 55 | store { 56 | ## store mode: file、db 57 | mode = "file" 58 | 59 | ## file store 60 | file { 61 | dir = "sessionStore" 62 | 63 | # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions 64 | max-branch-session-size = 16384 65 | # globe session size , if exceeded throws exceptions 66 | max-global-session-size = 512 67 | # file buffer size , if exceeded allocate new buffer 68 | file-write-buffer-cache-size = 16384 69 | # when recover batch read size 70 | session.reload.read_size = 100 71 | # async, sync 72 | flush-disk-mode = async 73 | } 74 | 75 | ## database store 76 | db { 77 | ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc. 78 | datasource = "dbcp" 79 | ## mysql/oracle/h2/oceanbase etc. 80 | db-type = "mysql" 81 | driver-class-name = "com.mysql.jdbc.Driver" 82 | url = "jdbc:mysql://127.0.0.1:3306/seata" 83 | user = "mysql" 84 | password = "mysql" 85 | min-conn = 1 86 | max-conn = 3 87 | global.table = "global_table" 88 | branch.table = "branch_table" 89 | lock-table = "lock_table" 90 | query-limit = 100 91 | } 92 | } 93 | lock { 94 | ## the lock store mode: local、remote 95 | mode = "remote" 96 | 97 | local { 98 | ## store locks in user's database 99 | } 100 | 101 | remote { 102 | ## store locks in the seata's server 103 | } 104 | } 105 | recovery { 106 | #schedule committing retry period in milliseconds 107 | committing-retry-period = 1000 108 | #schedule asyn committing retry period in milliseconds 109 | asyn-committing-retry-period = 1000 110 | #schedule rollbacking retry period in milliseconds 111 | rollbacking-retry-period = 1000 112 | #schedule timeout retry period in milliseconds 113 | timeout-retry-period = 1000 114 | } 115 | 116 | transaction { 117 | undo.data.validation = true 118 | undo.log.serialization = "jackson" 119 | undo.log.save.days = 7 120 | #schedule delete expired undo_log in milliseconds 121 | undo.log.delete.period = 86400000 122 | undo.log.table = "undo_log" 123 | } 124 | 125 | ## metrics settings 126 | metrics { 127 | enabled = false 128 | registry-type = "compact" 129 | # multi exporters use comma divided 130 | exporter-list = "prometheus" 131 | exporter-prometheus-port = 9898 132 | } 133 | 134 | support { 135 | ## spring 136 | spring { 137 | # auto proxy the DataSource bean 138 | datasource.autoproxy = false 139 | } 140 | } -------------------------------------------------------------------------------- /seata-pay-service/src/main/resources/file.conf: -------------------------------------------------------------------------------- 1 | transport { 2 | # tcp udt unix-domain-socket 3 | type = "TCP" 4 | #NIO NATIVE 5 | server = "NIO" 6 | #enable heartbeat 7 | heartbeat = true 8 | #thread factory for netty 9 | thread-factory { 10 | boss-thread-prefix = "NettyBoss" 11 | worker-thread-prefix = "NettyServerNIOWorker" 12 | server-executor-thread-prefix = "NettyServerBizHandler" 13 | share-boss-worker = false 14 | client-selector-thread-prefix = "NettyClientSelector" 15 | client-selector-thread-size = 1 16 | client-worker-thread-prefix = "NettyClientWorkerThread" 17 | # netty boss thread size,will not be used for UDT 18 | boss-thread-size = 1 19 | #auto default pin or 8 20 | worker-thread-size = 8 21 | } 22 | shutdown { 23 | # when destroy server, wait seconds 24 | wait = 3 25 | } 26 | serialization = "seata" 27 | compressor = "none" 28 | } 29 | service { 30 | #vgroup->rgroup 31 | vgroup_mapping.pay-service-seata-service-group = "default" 32 | #only support single node 33 | default.grouplist = "127.0.0.1:8091" 34 | #degrade current not support 35 | enableDegrade = false 36 | #disable 37 | disable = false 38 | #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent 39 | max.commit.retry.timeout = "-1" 40 | max.rollback.retry.timeout = "-1" 41 | } 42 | 43 | client { 44 | async.commit.buffer.limit = 10000 45 | lock { 46 | retry.internal = 10 47 | retry.times = 30 48 | } 49 | report.retry.count = 5 50 | tm.commit.retry.count = 1 51 | tm.rollback.retry.count = 1 52 | } 53 | 54 | ## transaction log store 55 | store { 56 | ## store mode: file、db 57 | mode = "file" 58 | 59 | ## file store 60 | file { 61 | dir = "sessionStore" 62 | 63 | # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions 64 | max-branch-session-size = 16384 65 | # globe session size , if exceeded throws exceptions 66 | max-global-session-size = 512 67 | # file buffer size , if exceeded allocate new buffer 68 | file-write-buffer-cache-size = 16384 69 | # when recover batch read size 70 | session.reload.read_size = 100 71 | # async, sync 72 | flush-disk-mode = async 73 | } 74 | 75 | ## database store 76 | db { 77 | ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc. 78 | datasource = "dbcp" 79 | ## mysql/oracle/h2/oceanbase etc. 80 | db-type = "mysql" 81 | driver-class-name = "com.mysql.jdbc.Driver" 82 | url = "jdbc:mysql://127.0.0.1:3306/seata" 83 | user = "mysql" 84 | password = "mysql" 85 | min-conn = 1 86 | max-conn = 3 87 | global.table = "global_table" 88 | branch.table = "branch_table" 89 | lock-table = "lock_table" 90 | query-limit = 100 91 | } 92 | } 93 | lock { 94 | ## the lock store mode: local、remote 95 | mode = "remote" 96 | 97 | local { 98 | ## store locks in user's database 99 | } 100 | 101 | remote { 102 | ## store locks in the seata's server 103 | } 104 | } 105 | recovery { 106 | #schedule committing retry period in milliseconds 107 | committing-retry-period = 1000 108 | #schedule asyn committing retry period in milliseconds 109 | asyn-committing-retry-period = 1000 110 | #schedule rollbacking retry period in milliseconds 111 | rollbacking-retry-period = 1000 112 | #schedule timeout retry period in milliseconds 113 | timeout-retry-period = 1000 114 | } 115 | 116 | transaction { 117 | undo.data.validation = true 118 | undo.log.serialization = "jackson" 119 | undo.log.save.days = 7 120 | #schedule delete expired undo_log in milliseconds 121 | undo.log.delete.period = 86400000 122 | undo.log.table = "undo_log" 123 | } 124 | 125 | ## metrics settings 126 | metrics { 127 | enabled = false 128 | registry-type = "compact" 129 | # multi exporters use comma divided 130 | exporter-list = "prometheus" 131 | exporter-prometheus-port = 9898 132 | } 133 | 134 | support { 135 | ## spring 136 | spring { 137 | # auto proxy the DataSource bean 138 | datasource.autoproxy = false 139 | } 140 | } -------------------------------------------------------------------------------- /seata-order-service/src/main/resources/file.conf: -------------------------------------------------------------------------------- 1 | transport { 2 | # tcp udt unix-domain-socket 3 | type = "TCP" 4 | #NIO NATIVE 5 | server = "NIO" 6 | #enable heartbeat 7 | heartbeat = true 8 | #thread factory for netty 9 | thread-factory { 10 | boss-thread-prefix = "NettyBoss" 11 | worker-thread-prefix = "NettyServerNIOWorker" 12 | server-executor-thread-prefix = "NettyServerBizHandler" 13 | share-boss-worker = false 14 | client-selector-thread-prefix = "NettyClientSelector" 15 | client-selector-thread-size = 1 16 | client-worker-thread-prefix = "NettyClientWorkerThread" 17 | # netty boss thread size,will not be used for UDT 18 | boss-thread-size = 1 19 | #auto default pin or 8 20 | worker-thread-size = 8 21 | } 22 | shutdown { 23 | # when destroy server, wait seconds 24 | wait = 3 25 | } 26 | serialization = "seata" 27 | compressor = "none" 28 | } 29 | service { 30 | #vgroup->rgroup 31 | vgroup_mapping.order-service-seata-service-group = "default" 32 | #only support single node 33 | default.grouplist = "127.0.0.1:8091" 34 | #degrade current not support 35 | enableDegrade = false 36 | #disable 37 | disable = false 38 | #unit ms,s,m,h,d represents milliseconds, seconds, minutes, hours, days, default permanent 39 | max.commit.retry.timeout = "-1" 40 | max.rollback.retry.timeout = "-1" 41 | } 42 | 43 | client { 44 | async.commit.buffer.limit = 10000 45 | lock { 46 | retry.internal = 10 47 | retry.times = 30 48 | } 49 | report.retry.count = 5 50 | tm.commit.retry.count = 1 51 | tm.rollback.retry.count = 1 52 | } 53 | 54 | ## transaction log store 55 | store { 56 | ## store mode: file、db 57 | mode = "file" 58 | 59 | ## file store 60 | file { 61 | dir = "sessionStore" 62 | 63 | # branch session size , if exceeded first try compress lockkey, still exceeded throws exceptions 64 | max-branch-session-size = 16384 65 | # globe session size , if exceeded throws exceptions 66 | max-global-session-size = 512 67 | # file buffer size , if exceeded allocate new buffer 68 | file-write-buffer-cache-size = 16384 69 | # when recover batch read size 70 | session.reload.read_size = 100 71 | # async, sync 72 | flush-disk-mode = async 73 | } 74 | 75 | ## database store 76 | db { 77 | ## the implement of javax.sql.DataSource, such as DruidDataSource(druid)/BasicDataSource(dbcp) etc. 78 | datasource = "dbcp" 79 | ## mysql/oracle/h2/oceanbase etc. 80 | db-type = "mysql" 81 | driver-class-name = "com.mysql.jdbc.Driver" 82 | url = "jdbc:mysql://127.0.0.1:3306/seata" 83 | user = "mysql" 84 | password = "mysql" 85 | min-conn = 1 86 | max-conn = 3 87 | global.table = "global_table" 88 | branch.table = "branch_table" 89 | lock-table = "lock_table" 90 | query-limit = 100 91 | } 92 | } 93 | lock { 94 | ## the lock store mode: local、remote 95 | mode = "remote" 96 | 97 | local { 98 | ## store locks in user's database 99 | } 100 | 101 | remote { 102 | ## store locks in the seata's server 103 | } 104 | } 105 | recovery { 106 | #schedule committing retry period in milliseconds 107 | committing-retry-period = 1000 108 | #schedule asyn committing retry period in milliseconds 109 | asyn-committing-retry-period = 1000 110 | #schedule rollbacking retry period in milliseconds 111 | rollbacking-retry-period = 1000 112 | #schedule timeout retry period in milliseconds 113 | timeout-retry-period = 1000 114 | } 115 | 116 | transaction { 117 | undo.data.validation = true 118 | undo.log.serialization = "jackson" 119 | undo.log.save.days = 7 120 | #schedule delete expired undo_log in milliseconds 121 | undo.log.delete.period = 86400000 122 | undo.log.table = "undo_log" 123 | } 124 | 125 | ## metrics settings 126 | metrics { 127 | enabled = false 128 | registry-type = "compact" 129 | # multi exporters use comma divided 130 | exporter-list = "prometheus" 131 | exporter-prometheus-port = 9898 132 | } 133 | 134 | support { 135 | ## spring 136 | spring { 137 | # auto proxy the DataSource bean 138 | datasource.autoproxy = false 139 | } 140 | } -------------------------------------------------------------------------------- /nacos-config-client/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-config-client-load/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-discovery-provider/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-feign/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-discovery-consumer-webflux/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /nacos-discovery-gateway-server/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | Licensed to the Apache Software Foundation (ASF) under one 3 | or more contributor license agreements. See the NOTICE file 4 | distributed with this work for additional information 5 | regarding copyright ownership. The ASF licenses this file 6 | to you under the Apache License, Version 2.0 (the 7 | "License"); you may not use this file except in compliance 8 | with the License. You may obtain a copy of the License at 9 | 10 | http://www.apache.org/licenses/LICENSE-2.0 11 | 12 | Unless required by applicable law or agreed to in writing, 13 | software distributed under the License is distributed on an 14 | "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | KIND, either express or implied. See the License for the 16 | specific language governing permissions and limitations 17 | under the License. 18 | */ 19 | 20 | import java.io.File; 21 | import java.io.FileInputStream; 22 | import java.io.FileOutputStream; 23 | import java.io.IOException; 24 | import java.net.URL; 25 | import java.nio.channels.Channels; 26 | import java.nio.channels.ReadableByteChannel; 27 | import java.util.Properties; 28 | 29 | public class MavenWrapperDownloader { 30 | 31 | /** 32 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 33 | */ 34 | private static final String DEFAULT_DOWNLOAD_URL = 35 | "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar"; 36 | 37 | /** 38 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 39 | * use instead of the default one. 40 | */ 41 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 42 | ".mvn/wrapper/maven-wrapper.properties"; 43 | 44 | /** 45 | * Path where the maven-wrapper.jar will be saved to. 46 | */ 47 | private static final String MAVEN_WRAPPER_JAR_PATH = 48 | ".mvn/wrapper/maven-wrapper.jar"; 49 | 50 | /** 51 | * Name of the property which should be used to override the default download url for the wrapper. 52 | */ 53 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 54 | 55 | public static void main(String args[]) { 56 | System.out.println("- Downloader started"); 57 | File baseDirectory = new File(args[0]); 58 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 59 | 60 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 61 | // wrapperUrl parameter. 62 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 63 | String url = DEFAULT_DOWNLOAD_URL; 64 | if (mavenWrapperPropertyFile.exists()) { 65 | FileInputStream mavenWrapperPropertyFileInputStream = null; 66 | try { 67 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 68 | Properties mavenWrapperProperties = new Properties(); 69 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 70 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 71 | } catch (IOException e) { 72 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 73 | } finally { 74 | try { 75 | if (mavenWrapperPropertyFileInputStream != null) { 76 | mavenWrapperPropertyFileInputStream.close(); 77 | } 78 | } catch (IOException e) { 79 | // Ignore ... 80 | } 81 | } 82 | } 83 | System.out.println("- Downloading from: : " + url); 84 | 85 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 86 | if (!outputFile.getParentFile().exists()) { 87 | if (!outputFile.getParentFile().mkdirs()) { 88 | System.out.println( 89 | "- ERROR creating output direcrory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 90 | } 91 | } 92 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 93 | try { 94 | downloadFileFromURL(url, outputFile); 95 | System.out.println("Done"); 96 | System.exit(0); 97 | } catch (Throwable e) { 98 | System.out.println("- Error downloading"); 99 | e.printStackTrace(); 100 | System.exit(1); 101 | } 102 | } 103 | 104 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 105 | URL website = new URL(urlString); 106 | ReadableByteChannel rbc; 107 | rbc = Channels.newChannel(website.openStream()); 108 | FileOutputStream fos = new FileOutputStream(destination); 109 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 110 | fos.close(); 111 | rbc.close(); 112 | } 113 | 114 | } 115 | -------------------------------------------------------------------------------- /sentinel-core-example/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.util.Properties; 18 | 19 | public class MavenWrapperDownloader { 20 | 21 | private static final String WRAPPER_VERSION = "0.5.5"; 22 | /** 23 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 24 | */ 25 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 26 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 27 | 28 | /** 29 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 30 | * use instead of the default one. 31 | */ 32 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 33 | ".mvn/wrapper/maven-wrapper.properties"; 34 | 35 | /** 36 | * Path where the maven-wrapper.jar will be saved to. 37 | */ 38 | private static final String MAVEN_WRAPPER_JAR_PATH = 39 | ".mvn/wrapper/maven-wrapper.jar"; 40 | 41 | /** 42 | * Name of the property which should be used to override the default download url for the wrapper. 43 | */ 44 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 45 | 46 | public static void main(String args[]) { 47 | System.out.println("- Downloader started"); 48 | File baseDirectory = new File(args[0]); 49 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 50 | 51 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 52 | // wrapperUrl parameter. 53 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 54 | String url = DEFAULT_DOWNLOAD_URL; 55 | if (mavenWrapperPropertyFile.exists()) { 56 | FileInputStream mavenWrapperPropertyFileInputStream = null; 57 | try { 58 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 59 | Properties mavenWrapperProperties = new Properties(); 60 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 61 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 62 | } catch (IOException e) { 63 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 64 | } finally { 65 | try { 66 | if (mavenWrapperPropertyFileInputStream != null) { 67 | mavenWrapperPropertyFileInputStream.close(); 68 | } 69 | } catch (IOException e) { 70 | // Ignore ... 71 | } 72 | } 73 | } 74 | System.out.println("- Downloading from: " + url); 75 | 76 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 77 | if (!outputFile.getParentFile().exists()) { 78 | if (!outputFile.getParentFile().mkdirs()) { 79 | System.out.println( 80 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 81 | } 82 | } 83 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 84 | try { 85 | downloadFileFromURL(url, outputFile); 86 | System.out.println("Done"); 87 | System.exit(0); 88 | } catch (Throwable e) { 89 | System.out.println("- Error downloading"); 90 | e.printStackTrace(); 91 | System.exit(1); 92 | } 93 | } 94 | 95 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 96 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 97 | String username = System.getenv("MVNW_USERNAME"); 98 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 99 | Authenticator.setDefault(new Authenticator() { 100 | @Override 101 | protected PasswordAuthentication getPasswordAuthentication() { 102 | return new PasswordAuthentication(username, password); 103 | } 104 | }); 105 | } 106 | URL website = new URL(urlString); 107 | ReadableByteChannel rbc; 108 | rbc = Channels.newChannel(website.openStream()); 109 | FileOutputStream fos = new FileOutputStream(destination); 110 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 111 | fos.close(); 112 | rbc.close(); 113 | } 114 | 115 | } 116 | -------------------------------------------------------------------------------- /seata-biz-service/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.5"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /seata-order-service/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.5"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /seata-pay-service/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.5"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /sentinel-feign-consumer/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.5"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /sentinel-feign-provier/.mvn/wrapper/MavenWrapperDownloader.java: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright 2012-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 | * 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 | import java.net.*; 18 | import java.io.*; 19 | import java.nio.channels.*; 20 | import java.util.Properties; 21 | 22 | public class MavenWrapperDownloader { 23 | 24 | private static final String WRAPPER_VERSION = "0.5.5"; 25 | /** 26 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided. 27 | */ 28 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/" 29 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar"; 30 | 31 | /** 32 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to 33 | * use instead of the default one. 34 | */ 35 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH = 36 | ".mvn/wrapper/maven-wrapper.properties"; 37 | 38 | /** 39 | * Path where the maven-wrapper.jar will be saved to. 40 | */ 41 | private static final String MAVEN_WRAPPER_JAR_PATH = 42 | ".mvn/wrapper/maven-wrapper.jar"; 43 | 44 | /** 45 | * Name of the property which should be used to override the default download url for the wrapper. 46 | */ 47 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl"; 48 | 49 | public static void main(String args[]) { 50 | System.out.println("- Downloader started"); 51 | File baseDirectory = new File(args[0]); 52 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath()); 53 | 54 | // If the maven-wrapper.properties exists, read it and check if it contains a custom 55 | // wrapperUrl parameter. 56 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH); 57 | String url = DEFAULT_DOWNLOAD_URL; 58 | if (mavenWrapperPropertyFile.exists()) { 59 | FileInputStream mavenWrapperPropertyFileInputStream = null; 60 | try { 61 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile); 62 | Properties mavenWrapperProperties = new Properties(); 63 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream); 64 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url); 65 | } catch (IOException e) { 66 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'"); 67 | } finally { 68 | try { 69 | if (mavenWrapperPropertyFileInputStream != null) { 70 | mavenWrapperPropertyFileInputStream.close(); 71 | } 72 | } catch (IOException e) { 73 | // Ignore ... 74 | } 75 | } 76 | } 77 | System.out.println("- Downloading from: " + url); 78 | 79 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH); 80 | if (!outputFile.getParentFile().exists()) { 81 | if (!outputFile.getParentFile().mkdirs()) { 82 | System.out.println( 83 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'"); 84 | } 85 | } 86 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath()); 87 | try { 88 | downloadFileFromURL(url, outputFile); 89 | System.out.println("Done"); 90 | System.exit(0); 91 | } catch (Throwable e) { 92 | System.out.println("- Error downloading"); 93 | e.printStackTrace(); 94 | System.exit(1); 95 | } 96 | } 97 | 98 | private static void downloadFileFromURL(String urlString, File destination) throws Exception { 99 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) { 100 | String username = System.getenv("MVNW_USERNAME"); 101 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray(); 102 | Authenticator.setDefault(new Authenticator() { 103 | @Override 104 | protected PasswordAuthentication getPasswordAuthentication() { 105 | return new PasswordAuthentication(username, password); 106 | } 107 | }); 108 | } 109 | URL website = new URL(urlString); 110 | ReadableByteChannel rbc; 111 | rbc = Channels.newChannel(website.openStream()); 112 | FileOutputStream fos = new FileOutputStream(destination); 113 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE); 114 | fos.close(); 115 | rbc.close(); 116 | } 117 | 118 | } 119 | -------------------------------------------------------------------------------- /nacos-config-client/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /nacos-config-client-load/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | -------------------------------------------------------------------------------- /nacos-discovery-consumer/mvnw.cmd: -------------------------------------------------------------------------------- 1 | @REM ---------------------------------------------------------------------------- 2 | @REM Licensed to the Apache Software Foundation (ASF) under one 3 | @REM or more contributor license agreements. See the NOTICE file 4 | @REM distributed with this work for additional information 5 | @REM regarding copyright ownership. The ASF licenses this file 6 | @REM to you under the Apache License, Version 2.0 (the 7 | @REM "License"); you may not use this file except in compliance 8 | @REM with the License. You may obtain a copy of the License at 9 | @REM 10 | @REM http://www.apache.org/licenses/LICENSE-2.0 11 | @REM 12 | @REM Unless required by applicable law or agreed to in writing, 13 | @REM software distributed under the License is distributed on an 14 | @REM "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 | @REM KIND, either express or implied. See the License for the 16 | @REM specific language governing permissions and limitations 17 | @REM under the License. 18 | @REM ---------------------------------------------------------------------------- 19 | 20 | @REM ---------------------------------------------------------------------------- 21 | @REM Maven2 Start Up Batch script 22 | @REM 23 | @REM Required ENV vars: 24 | @REM JAVA_HOME - location of a JDK home dir 25 | @REM 26 | @REM Optional ENV vars 27 | @REM M2_HOME - location of maven2's installed home dir 28 | @REM MAVEN_BATCH_ECHO - set to 'on' to enable the echoing of the batch commands 29 | @REM MAVEN_BATCH_PAUSE - set to 'on' to wait for a key stroke before ending 30 | @REM MAVEN_OPTS - parameters passed to the Java VM when running Maven 31 | @REM e.g. to debug Maven itself, use 32 | @REM set MAVEN_OPTS=-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000 33 | @REM MAVEN_SKIP_RC - flag to disable loading of mavenrc files 34 | @REM ---------------------------------------------------------------------------- 35 | 36 | @REM Begin all REM lines with '@' in case MAVEN_BATCH_ECHO is 'on' 37 | @echo off 38 | @REM set title of command window 39 | title %0 40 | @REM enable echoing my setting MAVEN_BATCH_ECHO to 'on' 41 | @if "%MAVEN_BATCH_ECHO%" == "on" echo %MAVEN_BATCH_ECHO% 42 | 43 | @REM set %HOME% to equivalent of $HOME 44 | if "%HOME%" == "" (set "HOME=%HOMEDRIVE%%HOMEPATH%") 45 | 46 | @REM Execute a user defined script before this one 47 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPre 48 | @REM check for pre script, once with legacy .bat ending and once with .cmd ending 49 | if exist "%HOME%\mavenrc_pre.bat" call "%HOME%\mavenrc_pre.bat" 50 | if exist "%HOME%\mavenrc_pre.cmd" call "%HOME%\mavenrc_pre.cmd" 51 | :skipRcPre 52 | 53 | @setlocal 54 | 55 | set ERROR_CODE=0 56 | 57 | @REM To isolate internal variables from possible post scripts, we use another setlocal 58 | @setlocal 59 | 60 | @REM ==== START VALIDATION ==== 61 | if not "%JAVA_HOME%" == "" goto OkJHome 62 | 63 | echo. 64 | echo Error: JAVA_HOME not found in your environment. >&2 65 | echo Please set the JAVA_HOME variable in your environment to match the >&2 66 | echo location of your Java installation. >&2 67 | echo. 68 | goto error 69 | 70 | :OkJHome 71 | if exist "%JAVA_HOME%\bin\java.exe" goto init 72 | 73 | echo. 74 | echo Error: JAVA_HOME is set to an invalid directory. >&2 75 | echo JAVA_HOME = "%JAVA_HOME%" >&2 76 | echo Please set the JAVA_HOME variable in your environment to match the >&2 77 | echo location of your Java installation. >&2 78 | echo. 79 | goto error 80 | 81 | @REM ==== END VALIDATION ==== 82 | 83 | :init 84 | 85 | @REM Find the project base dir, i.e. the directory that contains the folder ".mvn". 86 | @REM Fallback to current working directory if not found. 87 | 88 | set MAVEN_PROJECTBASEDIR=%MAVEN_BASEDIR% 89 | IF NOT "%MAVEN_PROJECTBASEDIR%"=="" goto endDetectBaseDir 90 | 91 | set EXEC_DIR=%CD% 92 | set WDIR=%EXEC_DIR% 93 | :findBaseDir 94 | IF EXIST "%WDIR%"\.mvn goto baseDirFound 95 | cd .. 96 | IF "%WDIR%"=="%CD%" goto baseDirNotFound 97 | set WDIR=%CD% 98 | goto findBaseDir 99 | 100 | :baseDirFound 101 | set MAVEN_PROJECTBASEDIR=%WDIR% 102 | cd "%EXEC_DIR%" 103 | goto endDetectBaseDir 104 | 105 | :baseDirNotFound 106 | set MAVEN_PROJECTBASEDIR=%EXEC_DIR% 107 | cd "%EXEC_DIR%" 108 | 109 | :endDetectBaseDir 110 | 111 | IF NOT EXIST "%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config" goto endReadAdditionalConfig 112 | 113 | @setlocal EnableExtensions EnableDelayedExpansion 114 | for /F "usebackq delims=" %%a in ("%MAVEN_PROJECTBASEDIR%\.mvn\jvm.config") do set JVM_CONFIG_MAVEN_PROPS=!JVM_CONFIG_MAVEN_PROPS! %%a 115 | @endlocal & set JVM_CONFIG_MAVEN_PROPS=%JVM_CONFIG_MAVEN_PROPS% 116 | 117 | :endReadAdditionalConfig 118 | 119 | SET MAVEN_JAVA_EXE="%JAVA_HOME%\bin\java.exe" 120 | set WRAPPER_JAR="%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.jar" 121 | set WRAPPER_LAUNCHER=org.apache.maven.wrapper.MavenWrapperMain 122 | 123 | set DOWNLOAD_URL="https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.4.2/maven-wrapper-0.4.2.jar" 124 | FOR /F "tokens=1,2 delims==" %%A IN (%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties) DO ( 125 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B 126 | ) 127 | 128 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central 129 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data. 130 | if exist %WRAPPER_JAR% ( 131 | echo Found %WRAPPER_JAR% 132 | ) else ( 133 | echo Couldn't find %WRAPPER_JAR%, downloading it ... 134 | echo Downloading from: %DOWNLOAD_URL% 135 | powershell -Command "(New-Object Net.WebClient).DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')" 136 | echo Finished downloading %WRAPPER_JAR% 137 | ) 138 | @REM End of extension 139 | 140 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %* 141 | if ERRORLEVEL 1 goto error 142 | goto end 143 | 144 | :error 145 | set ERROR_CODE=1 146 | 147 | :end 148 | @endlocal & set ERROR_CODE=%ERROR_CODE% 149 | 150 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost 151 | @REM check for post script, once with legacy .bat ending and once with .cmd ending 152 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat" 153 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd" 154 | :skipRcPost 155 | 156 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on' 157 | if "%MAVEN_BATCH_PAUSE%" == "on" pause 158 | 159 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE% 160 | 161 | exit /B %ERROR_CODE% 162 | --------------------------------------------------------------------------------