├── README.md
├── sp11-zuul
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp11
│ │ │ └── Sp11ZuulApplicationTests.java
│ └── main
│ │ ├── resources
│ │ ├── bootstrap.yml
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp11
│ │ ├── Sp11ZuulApplication.java
│ │ ├── filter
│ │ └── AccessFilter.java
│ │ └── fallback
│ │ ├── OrderServiceFallback.java
│ │ └── ItemServiceFallback.java
├── .gitignore
├── pom.xml
└── mvnw.cmd
├── sp05-eureka
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application-eureka1.yml
│ │ │ ├── application-eureka2.yml
│ │ │ └── application.yml
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp05
│ │ │ └── Sp05EurekaApplication.java
│ └── test
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp05
│ │ └── Sp05EurekaApplicationTests.java
├── .gitignore
├── pom.xml
└── mvnw.cmd
├── sp06-ribbon
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp06
│ │ │ └── Sp06RibbonApplicationTests.java
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp06
│ │ ├── Sp06RibbonApplication.java
│ │ └── consoller
│ │ └── RibbonController.java
├── .gitignore
├── pom.xml
└── mvnw.cmd
├── sp07-hystrix
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp06
│ │ │ └── Sp06RibbonApplicationTests.java
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp06
│ │ ├── Sp06RibbonApplication.java
│ │ └── consoller
│ │ └── RibbonController.java
├── .gitignore
├── pom.xml
└── mvnw.cmd
├── sp09-feign
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp09
│ │ │ └── Sp09FeignApplicationTests.java
│ └── main
│ │ ├── java
│ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp09
│ │ │ ├── service
│ │ │ ├── OrderFeignServiceFB.java
│ │ │ ├── UserFeignServiceFB.java
│ │ │ ├── ItemFeignServiceFB.java
│ │ │ ├── OrderFeignService.java
│ │ │ ├── ItemFeignService.java
│ │ │ └── UserFeignService.java
│ │ │ ├── Sp09FeignApplication.java
│ │ │ └── controller
│ │ │ └── FeignController.java
│ │ └── resources
│ │ └── application.yml
├── .gitignore
├── pom.xml
└── mvnw.cmd
├── sp10-turbine
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp10
│ │ │ └── Sp10TurbineApplicationTests.java
│ └── main
│ │ ├── resources
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp10
│ │ └── Sp10TurbineApplication.java
├── .gitignore
└── pom.xml
├── sp12-config
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp12
│ │ │ └── Sp12ConfigApplicationTests.java
│ └── main
│ │ ├── resources
│ │ ├── config
│ │ │ ├── item-service-dev.yml
│ │ │ ├── order-service-dev.yml
│ │ │ ├── user-service-dev.yml
│ │ │ └── zuul-dev.yml
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp12
│ │ └── Sp12ConfigApplication.java
├── .gitignore
└── pom.xml
├── sp01-commons
├── .settings
│ ├── org.eclipse.m2e.core.prefs
│ └── org.eclipse.jdt.core.prefs
├── target
│ └── classes
│ │ ├── META-INF
│ │ ├── MANIFEST.MF
│ │ └── maven
│ │ │ └── cn.tedu
│ │ │ └── sp01-commons
│ │ │ ├── pom.properties
│ │ │ └── pom.xml
│ │ └── cn
│ │ └── tedu
│ │ ├── sp01
│ │ ├── pojo
│ │ │ ├── Item.class
│ │ │ ├── Order.class
│ │ │ └── User.class
│ │ └── service
│ │ │ ├── ItemService.class
│ │ │ ├── OrderService.class
│ │ │ └── UserService.class
│ │ └── web
│ │ └── util
│ │ ├── JsonUtil.class
│ │ ├── CookieUtil.class
│ │ ├── JsonResult.class
│ │ └── JsonUtil$1.class
├── src
│ └── main
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ ├── web
│ │ └── util
│ │ │ ├── JsonResult.java
│ │ │ └── CookieUtil.java
│ │ └── sp01
│ │ ├── service
│ │ ├── UserService.java
│ │ ├── OrderService.java
│ │ └── ItemService.java
│ │ └── pojo
│ │ ├── Item.java
│ │ ├── User.java
│ │ └── Order.java
├── .project
├── .classpath
└── pom.xml
├── sp02-itemservice
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── main
│ │ ├── resources
│ │ │ ├── application.yml
│ │ │ └── bootstrap.yml
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp02
│ │ │ ├── Sp02ItemserviceApplication.java
│ │ │ └── item
│ │ │ ├── service
│ │ │ └── ItemServiceImpl.java
│ │ │ └── controller
│ │ │ └── ItemController.java
│ └── test
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp02
│ │ └── Sp02ItemserviceApplicationTests.java
├── .gitignore
└── pom.xml
├── sp03-userservice
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp03
│ │ │ └── Sp03UserserviceApplicationTests.java
│ └── main
│ │ ├── resources
│ │ ├── bootstrap.yml
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp03
│ │ ├── Sp03UserserviceApplication.java
│ │ └── user
│ │ ├── controller
│ │ └── UserController.java
│ │ └── service
│ │ └── UserServiceImpl.java
├── .gitignore
└── pom.xml
├── sp04-orderservice
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── test
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp04
│ │ │ └── Sp04OrderserviceApplicationTests.java
│ └── main
│ │ ├── resources
│ │ ├── bootstrap.yml
│ │ └── application.yml
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp04
│ │ ├── Sp04OrderserviceApplication.java
│ │ └── order
│ │ ├── feignclient
│ │ ├── UserFeignServiceFB.java
│ │ ├── UserFeignService.java
│ │ ├── ItemFeignService.java
│ │ └── ItemFeignServiceFB.java
│ │ ├── controller
│ │ └── OrderController.java
│ │ └── service
│ │ └── OrderServiceImpl.java
├── .gitignore
└── pom.xml
├── sp08-hystrix-dashboard
├── .mvn
│ └── wrapper
│ │ ├── maven-wrapper.jar
│ │ ├── maven-wrapper.properties
│ │ └── MavenWrapperDownloader.java
├── src
│ ├── main
│ │ ├── resources
│ │ │ └── application.yml
│ │ └── java
│ │ │ └── cn
│ │ │ └── tedu
│ │ │ └── sp08
│ │ │ └── Sp08HystrixDashboardApplication.java
│ └── test
│ │ └── java
│ │ └── cn
│ │ └── tedu
│ │ └── sp08
│ │ └── Sp08HystrixDashboardApplicationTests.java
├── .gitignore
└── pom.xml
└── config
├── .project
├── item-service-dev.yml
├── order-service-dev.yml
├── user-service-dev.yml
└── zuul-dev.yml
/README.md:
--------------------------------------------------------------------------------
1 | # spring cloud 案例
2 |
3 | 完整笔记: https://blog.csdn.net/weixin_38305440/article/details/102775484
4 |
--------------------------------------------------------------------------------
/sp11-zuul/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp11-zuul/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp05-eureka/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp05-eureka/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp06-ribbon/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp06-ribbon/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp07-hystrix/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp07-hystrix/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp09-feign/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp09-feign/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp10-turbine/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp10-turbine/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp12-config/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp12-config/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp01-commons/.settings/org.eclipse.m2e.core.prefs:
--------------------------------------------------------------------------------
1 | activeProfiles=
2 | eclipse.preferences.version=1
3 | resolveWorkspaceProjects=true
4 | version=1
5 |
--------------------------------------------------------------------------------
/sp02-itemservice/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp02-itemservice/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp03-userservice/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp03-userservice/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp04-orderservice/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp04-orderservice/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/.mvn/wrapper/maven-wrapper.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp08-hystrix-dashboard/.mvn/wrapper/maven-wrapper.jar
--------------------------------------------------------------------------------
/sp01-commons/target/classes/META-INF/MANIFEST.MF:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | Built-By: benwang
3 | Build-Jdk: 1.8.0_152
4 | Created-By: Maven Integration for Eclipse
5 |
6 |
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/pojo/Item.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/pojo/Item.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/pojo/Order.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/pojo/Order.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/pojo/User.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/pojo/User.class
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/web/util/JsonResult.java:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/src/main/java/cn/tedu/web/util/JsonResult.java
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/web/util/JsonUtil.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/web/util/JsonUtil.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/web/util/CookieUtil.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/web/util/CookieUtil.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/web/util/JsonResult.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/web/util/JsonResult.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/web/util/JsonUtil$1.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/web/util/JsonUtil$1.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/service/ItemService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/service/ItemService.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/service/OrderService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/service/OrderService.class
--------------------------------------------------------------------------------
/sp01-commons/target/classes/cn/tedu/sp01/service/UserService.class:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/benwang6/spring-cloud-repo/HEAD/sp01-commons/target/classes/cn/tedu/sp01/service/UserService.class
--------------------------------------------------------------------------------
/config/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | config
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/service/UserService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.service;
2 |
3 | import cn.tedu.sp01.pojo.User;
4 |
5 | public interface UserService {
6 | User getUser(Integer id);
7 | void addScore(Integer id, Integer score);
8 | }
9 |
--------------------------------------------------------------------------------
/sp11-zuul/.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 |
--------------------------------------------------------------------------------
/sp05-eureka/.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 |
--------------------------------------------------------------------------------
/sp06-ribbon/.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 |
--------------------------------------------------------------------------------
/sp07-hystrix/.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 |
--------------------------------------------------------------------------------
/sp09-feign/.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 |
--------------------------------------------------------------------------------
/sp10-turbine/.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 |
--------------------------------------------------------------------------------
/sp12-config/.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 |
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/service/OrderService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.service;
2 |
3 |
4 | import cn.tedu.sp01.pojo.Order;
5 |
6 | public interface OrderService {
7 | Order getOrder(String orderId);
8 | void addOrder(Order order);
9 | }
10 |
--------------------------------------------------------------------------------
/sp02-itemservice/.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 |
--------------------------------------------------------------------------------
/sp03-userservice/.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 |
--------------------------------------------------------------------------------
/sp04-orderservice/.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 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/.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 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: hystrix-dashboard
4 |
5 | server:
6 | port: 4001
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/service/ItemService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.service;
2 |
3 | import java.util.List;
4 |
5 | import cn.tedu.sp01.pojo.Item;
6 |
7 | public interface ItemService {
8 | List- getItems(String orderId);
9 | void decreaseNumbers(List
- list);
10 | }
--------------------------------------------------------------------------------
/sp05-eureka/src/main/resources/application-eureka1.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | instance:
3 | hostname: eureka1
4 | client:
5 | register-with-eureka: true #profile的配置会覆盖公用配置
6 | fetch-registry: true #profile的配置会覆盖公用配置
7 | service-url:
8 | defaultZone: http://eureka2:2002/eureka #eureka1启动时向eureka2注册
--------------------------------------------------------------------------------
/sp05-eureka/src/main/resources/application-eureka2.yml:
--------------------------------------------------------------------------------
1 | eureka:
2 | instance:
3 | hostname: eureka2
4 | client:
5 | register-with-eureka: true #profile的配置会覆盖公用配置
6 | fetch-registry: true #profile的配置会覆盖公用配置
7 | service-url:
8 | defaultZone: http://eureka1:2001/eureka #eureka2启动时向eureka1注册
--------------------------------------------------------------------------------
/sp02-itemservice/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | #spring:
2 | # application:
3 | # name: item-service
4 | #
5 | ## 启动参数 --server.port 可以覆盖yml配置
6 | #server:
7 | # port: 8001
8 | #
9 | #eureka:
10 | # client:
11 | # service-url:
12 | # defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
13 |
--------------------------------------------------------------------------------
/sp11-zuul/src/test/java/cn/tedu/sp11/Sp11ZuulApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp11;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp11ZuulApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp09-feign/src/test/java/cn/tedu/sp09/Sp09FeignApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp09FeignApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp05-eureka/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: eureka-server
4 |
5 | server:
6 | port: 2001
7 |
8 | eureka:
9 | server:
10 | enable-self-preservation: false
11 | instance:
12 | hostname: eureka1
13 | client:
14 | register-with-eureka: false
15 | fetch-registry: false
--------------------------------------------------------------------------------
/sp05-eureka/src/test/java/cn/tedu/sp05/Sp05EurekaApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp05;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp05EurekaApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp06-ribbon/src/test/java/cn/tedu/sp06/Sp06RibbonApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp06RibbonApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp07-hystrix/src/test/java/cn/tedu/sp06/Sp06RibbonApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp06RibbonApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp10-turbine/src/test/java/cn/tedu/sp10/Sp10TurbineApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp10;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp10TurbineApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp12-config/src/test/java/cn/tedu/sp12/Sp12ConfigApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp12;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp12ConfigApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp11-zuul/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | discovery:
5 | enabled: true
6 | service-id: config-server
7 | name: zuul
8 | profile: dev
9 |
10 | eureka:
11 | client:
12 | service-url:
13 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
--------------------------------------------------------------------------------
/sp02-itemservice/src/test/java/cn/tedu/sp02/Sp02ItemserviceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp02;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp02ItemserviceApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp03-userservice/src/test/java/cn/tedu/sp03/Sp03UserserviceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp03;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp03UserserviceApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp04-orderservice/src/test/java/cn/tedu/sp04/Sp04OrderserviceApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp04OrderserviceApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp02-itemservice/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | discovery:
5 | enabled: true
6 | service-id: config-server
7 | name: item-service
8 | profile: dev
9 |
10 | eureka:
11 | client:
12 | service-url:
13 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
--------------------------------------------------------------------------------
/sp03-userservice/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | discovery:
5 | enabled: true
6 | service-id: config-server
7 | name: user-service
8 | profile: dev
9 |
10 | eureka:
11 | client:
12 | service-url:
13 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
--------------------------------------------------------------------------------
/sp01-commons/target/classes/META-INF/maven/cn.tedu/sp01-commons/pom.properties:
--------------------------------------------------------------------------------
1 | #Generated by Maven Integration for Eclipse
2 | #Mon Dec 09 22:35:58 CST 2019
3 | version=0.0.1-SNAPSHOT
4 | groupId=cn.tedu
5 | m2e.projectName=sp01-commons
6 | m2e.projectLocation=D\:\\home\\java\\workspaces\\spring-cloud-8\\spring-cloud-repo\\sp01-commons
7 | artifactId=sp01-commons
8 |
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/resources/bootstrap.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | cloud:
3 | config:
4 | discovery:
5 | enabled: true
6 | service-id: config-server
7 | name: order-service
8 | profile: dev
9 |
10 | eureka:
11 | client:
12 | service-url:
13 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/src/test/java/cn/tedu/sp08/Sp08HystrixDashboardApplicationTests.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp08;
2 |
3 | import org.junit.jupiter.api.Test;
4 | import org.springframework.boot.test.context.SpringBootTest;
5 |
6 | @SpringBootTest
7 | class Sp08HystrixDashboardApplicationTests {
8 |
9 | @Test
10 | void contextLoads() {
11 | }
12 |
13 | }
14 |
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/pojo/Item.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.pojo;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Data
8 | @NoArgsConstructor
9 | @AllArgsConstructor
10 | public class Item {
11 | private Integer id;
12 | private String name;
13 | private Integer number;
14 | }
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/pojo/User.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.pojo;
2 |
3 | import lombok.AllArgsConstructor;
4 | import lombok.Data;
5 | import lombok.NoArgsConstructor;
6 |
7 | @Data
8 | @NoArgsConstructor
9 | @AllArgsConstructor
10 | public class User {
11 | private Integer id;
12 | private String username;
13 | private String password;
14 | }
--------------------------------------------------------------------------------
/sp06-ribbon/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: ribbon
4 |
5 | server:
6 | port: 3001
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 |
13 | ribbon:
14 | MaxAutoRetriesNextServer: 2
15 | MaxAutoRetries: 1
16 | OkToRetryOnAllOperations: true
--------------------------------------------------------------------------------
/sp10-turbine/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: turbin
4 |
5 | server:
6 | port: 5001
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 |
13 | turbine:
14 | app-config: order-service, zuul
15 | cluster-name-expression: new String("default")
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/sp01/pojo/Order.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp01.pojo;
2 |
3 | import java.util.List;
4 |
5 | import lombok.AllArgsConstructor;
6 | import lombok.Data;
7 | import lombok.NoArgsConstructor;
8 |
9 | @Data
10 | @NoArgsConstructor
11 | @AllArgsConstructor
12 | public class Order {
13 | private String id;
14 | private User user;
15 | private List
- items;
16 | }
--------------------------------------------------------------------------------
/config/item-service-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: item-service
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 8001
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 |
--------------------------------------------------------------------------------
/sp12-config/src/main/resources/config/item-service-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: item-service
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 8001
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 |
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | #spring:
2 | # application:
3 | # name: order-service
4 | #
5 | #server:
6 | # port: 8201
7 | #
8 | #eureka:
9 | # client:
10 | # service-url:
11 | # defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 | #
13 | #feign:
14 | # hystrix:
15 | # enabled: true
16 | #
17 | #management:
18 | # endpoints:
19 | # web:
20 | # exposure:
21 | # include: hystrix.stream
--------------------------------------------------------------------------------
/sp01-commons/.settings/org.eclipse.jdt.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
3 | org.eclipse.jdt.core.compiler.compliance=1.8
4 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled
5 | org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=ignore
7 | org.eclipse.jdt.core.compiler.release=disabled
8 | org.eclipse.jdt.core.compiler.source=1.8
9 |
--------------------------------------------------------------------------------
/sp05-eureka/.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 |
--------------------------------------------------------------------------------
/sp06-ribbon/.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 |
--------------------------------------------------------------------------------
/sp07-hystrix/.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 |
--------------------------------------------------------------------------------
/sp09-feign/.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 |
--------------------------------------------------------------------------------
/sp10-turbine/.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 |
--------------------------------------------------------------------------------
/sp11-zuul/.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 |
--------------------------------------------------------------------------------
/sp12-config/.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 |
--------------------------------------------------------------------------------
/sp02-itemservice/.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 |
--------------------------------------------------------------------------------
/sp03-userservice/.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 |
--------------------------------------------------------------------------------
/sp04-orderservice/.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 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/.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 |
--------------------------------------------------------------------------------
/sp03-userservice/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | #sp:
2 | # user-service:
3 | # users: "[{\"id\":7, \"username\":\"abc\",\"password\":\"123\"},{\"id\":8, \"username\":\"def\",\"password\":\"456\"},{\"id\":9, \"username\":\"ghi\",\"password\":\"789\"}]"
4 | #
5 | #spring:
6 | # application:
7 | # name: user-service
8 | #
9 | #server:
10 | # port: 8101
11 | #
12 | #eureka:
13 | # client:
14 | # service-url:
15 | # defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
16 |
--------------------------------------------------------------------------------
/sp05-eureka/src/main/java/cn/tedu/sp05/Sp05EurekaApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp05;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.netflix.eureka.server.EnableEurekaServer;
6 |
7 | @EnableEurekaServer
8 | @SpringBootApplication
9 | public class Sp05EurekaApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(Sp05EurekaApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/sp02-itemservice/src/main/java/cn/tedu/sp02/Sp02ItemserviceApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp02;
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 Sp02ItemserviceApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(Sp02ItemserviceApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/sp03-userservice/src/main/java/cn/tedu/sp03/Sp03UserserviceApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp03;
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 Sp03UserserviceApplication {
10 |
11 | public static void main(String[] args) {
12 | SpringApplication.run(Sp03UserserviceApplication.class, args);
13 | }
14 |
15 | }
16 |
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/OrderFeignServiceFB.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import org.springframework.stereotype.Component;
4 | import cn.tedu.sp01.pojo.Order;
5 | import cn.tedu.web.util.JsonResult;
6 |
7 | @Component
8 | public class OrderFeignServiceFB implements OrderFeignService {
9 |
10 | @Override
11 | public JsonResult getOrder(String orderId) {
12 | return JsonResult.err("无法获取商品订单");
13 | }
14 |
15 | @Override
16 | public JsonResult addOrder() {
17 | return JsonResult.err("无法保存订单");
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/UserFeignServiceFB.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import org.springframework.stereotype.Component;
4 | import cn.tedu.sp01.pojo.User;
5 | import cn.tedu.web.util.JsonResult;
6 |
7 | @Component
8 | public class UserFeignServiceFB implements UserFeignService {
9 |
10 | @Override
11 | public JsonResult getUser(Integer userId) {
12 | return JsonResult.err("无法获取用户信息");
13 | }
14 |
15 | @Override
16 | public JsonResult addScore(Integer userId, Integer score) {
17 | return JsonResult.err("无法增加用户积分");
18 | }
19 |
20 | }
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/Sp04OrderserviceApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.cloud.client.SpringCloudApplication;
5 | import org.springframework.cloud.openfeign.EnableFeignClients;
6 |
7 | //@EnableDiscoveryClient
8 | //@SpringBootApplication
9 |
10 | @EnableFeignClients
11 | @SpringCloudApplication
12 | public class Sp04OrderserviceApplication {
13 |
14 | public static void main(String[] args) {
15 | SpringApplication.run(Sp04OrderserviceApplication.class, args);
16 | }
17 | }
--------------------------------------------------------------------------------
/sp11-zuul/src/main/java/cn/tedu/sp11/Sp11ZuulApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp11;
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.netflix.zuul.EnableZuulProxy;
7 |
8 | @EnableZuulProxy
9 | @EnableDiscoveryClient
10 | @SpringBootApplication
11 | public class Sp11ZuulApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(Sp11ZuulApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/config/order-service-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: order-service
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 8201
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 | feign:
22 | hystrix:
23 | enabled: true
24 |
25 | management:
26 | endpoints:
27 | web:
28 | exposure:
29 | include: hystrix.stream
30 |
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/ItemFeignServiceFB.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import java.util.List;
4 | import org.springframework.stereotype.Component;
5 | import cn.tedu.sp01.pojo.Item;
6 | import cn.tedu.web.util.JsonResult;
7 |
8 | @Component
9 | public class ItemFeignServiceFB implements ItemFeignService {
10 |
11 | @Override
12 | public JsonResult
> getItems(String orderId) {
13 | return JsonResult.err("无法获取订单商品列表");
14 | }
15 |
16 | @Override
17 | public JsonResult decreaseNumber(List- items) {
18 | return JsonResult.err("无法修改商品库存");
19 | }
20 |
21 | }
--------------------------------------------------------------------------------
/sp10-turbine/src/main/java/cn/tedu/sp10/Sp10TurbineApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp10;
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.netflix.turbine.EnableTurbine;
7 |
8 | @EnableTurbine
9 | @EnableDiscoveryClient
10 | @SpringBootApplication
11 | public class Sp10TurbineApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(Sp10TurbineApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/sp12-config/src/main/java/cn/tedu/sp12/Sp12ConfigApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp12;
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.config.server.EnableConfigServer;
7 |
8 | @EnableConfigServer
9 | @EnableDiscoveryClient
10 | @SpringBootApplication
11 | public class Sp12ConfigApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(Sp12ConfigApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/sp12-config/src/main/resources/config/order-service-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: order-service
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 8201
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 | feign:
22 | hystrix:
23 | enabled: true
24 |
25 | management:
26 | endpoints:
27 | web:
28 | exposure:
29 | include: hystrix.stream
30 |
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/OrderFeignService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import org.springframework.cloud.openfeign.FeignClient;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 |
7 | import cn.tedu.sp01.pojo.Order;
8 | import cn.tedu.web.util.JsonResult;
9 |
10 | @FeignClient(name="order-service",fallback = OrderFeignServiceFB.class)
11 | public interface OrderFeignService {
12 | @GetMapping("/{orderId}")
13 | JsonResult getOrder(@PathVariable String orderId);
14 |
15 | @GetMapping("/")
16 | JsonResult addOrder();
17 |
18 | }
--------------------------------------------------------------------------------
/sp07-hystrix/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: hystrix
4 |
5 | server:
6 | port: 3001
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 |
13 | ribbon:
14 | MaxAutoRetriesNextServer: 1
15 | MaxAutoRetries: 1
16 | OkToRetryOnAllOperations: true
17 |
18 | hystrix:
19 | command:
20 | default:
21 | execution:
22 | isolation:
23 | thread:
24 | timeoutInMilliseconds: 500
25 |
26 | management:
27 | endpoints:
28 | web:
29 | exposure:
30 | include: hystrix.stream
--------------------------------------------------------------------------------
/sp01-commons/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | sp01-commons
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.jdt.core.javabuilder
10 |
11 |
12 |
13 |
14 | org.eclipse.m2e.core.maven2Builder
15 |
16 |
17 |
18 |
19 |
20 | org.eclipse.jdt.core.javanature
21 | org.eclipse.m2e.core.maven2Nature
22 |
23 |
24 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/src/main/java/cn/tedu/sp08/Sp08HystrixDashboardApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp08;
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.netflix.hystrix.dashboard.EnableHystrixDashboard;
7 |
8 | @EnableDiscoveryClient
9 | @EnableHystrixDashboard
10 | @SpringBootApplication
11 | public class Sp08HystrixDashboardApplication {
12 |
13 | public static void main(String[] args) {
14 | SpringApplication.run(Sp08HystrixDashboardApplication.class, args);
15 | }
16 |
17 | }
18 |
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/Sp09FeignApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.boot.autoconfigure.SpringBootApplication;
5 | import org.springframework.cloud.client.circuitbreaker.EnableCircuitBreaker;
6 | import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
7 | import org.springframework.cloud.openfeign.EnableFeignClients;
8 |
9 | @EnableCircuitBreaker
10 | @EnableFeignClients
11 | @EnableDiscoveryClient
12 | @SpringBootApplication
13 | public class Sp09FeignApplication {
14 |
15 | public static void main(String[] args) {
16 | SpringApplication.run(Sp09FeignApplication.class, args);
17 | }
18 |
19 | }
20 |
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feignclient/UserFeignServiceFB.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.feignclient;
2 |
3 | import org.springframework.stereotype.Component;
4 |
5 | import cn.tedu.sp01.pojo.User;
6 | import cn.tedu.web.util.JsonResult;
7 |
8 | @Component
9 | public class UserFeignServiceFB implements UserFeignService {
10 |
11 | @Override
12 | public JsonResult getUser(Integer userId) {
13 | if(Math.random()<0.4) {
14 | return JsonResult.ok(new User(userId, "缓存name"+userId, "缓存pwd"+userId));
15 | }
16 | return JsonResult.err("无法获取用户信息");
17 | }
18 |
19 | @Override
20 | public JsonResult addScore(Integer userId, Integer score) {
21 | return JsonResult.err("无法增加用户积分");
22 | }
23 |
24 | }
--------------------------------------------------------------------------------
/config/user-service-dev.yml:
--------------------------------------------------------------------------------
1 | sp:
2 | user-service:
3 | users: "[{\"id\":7, \"username\":\"abc\",\"password\":\"123\"},{\"id\":8, \"username\":\"def\",\"password\":\"456\"},{\"id\":9, \"username\":\"ghi\",\"password\":\"789\"},{\"id\":99, \"username\":\"aaa\",\"password\":\"111\"}]"
4 |
5 | spring:
6 | application:
7 | name: user-service
8 | cloud:
9 | config:
10 | override-none: true
11 | rabbitmq:
12 | host: 192.168.64.140
13 | port: 5672
14 | username: admin
15 | password: admin
16 |
17 | server:
18 | port: 8101
19 |
20 | eureka:
21 | client:
22 | service-url:
23 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
24 |
25 | management:
26 | endpoints:
27 | web:
28 | exposure:
29 | include: refresh
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feignclient/UserFeignService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.feignclient;
2 |
3 | import org.springframework.cloud.openfeign.FeignClient;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | import cn.tedu.sp01.pojo.User;
9 | import cn.tedu.web.util.JsonResult;
10 |
11 | @FeignClient(name="user-service", fallback = UserFeignServiceFB.class)
12 | public interface UserFeignService {
13 | @GetMapping("/{userId}")
14 | JsonResult getUser(@PathVariable Integer userId);
15 |
16 | @GetMapping("/{userId}/score")
17 | JsonResult addScore(@PathVariable Integer userId, @RequestParam Integer score);
18 | }
--------------------------------------------------------------------------------
/sp12-config/src/main/resources/config/user-service-dev.yml:
--------------------------------------------------------------------------------
1 | sp:
2 | user-service:
3 | users: "[{\"id\":7, \"username\":\"abc\",\"password\":\"123\"},{\"id\":8, \"username\":\"def\",\"password\":\"456\"},{\"id\":9, \"username\":\"ghi\",\"password\":\"789\"},{\"id\":99, \"username\":\"aaa\",\"password\":\"111\"}]"
4 |
5 | spring:
6 | application:
7 | name: user-service
8 | cloud:
9 | config:
10 | override-none: true
11 | rabbitmq:
12 | host: 192.168.64.140
13 | port: 5672
14 | username: admin
15 | password: admin
16 |
17 | server:
18 | port: 8101
19 |
20 | eureka:
21 | client:
22 | service-url:
23 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
24 |
25 | management:
26 | endpoints:
27 | web:
28 | exposure:
29 | include: refresh
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/ItemFeignService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.cloud.openfeign.FeignClient;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestBody;
10 |
11 | import cn.tedu.sp01.pojo.Item;
12 | import cn.tedu.web.util.JsonResult;
13 |
14 | @FeignClient(name="item-service", fallback = ItemFeignServiceFB.class)
15 | public interface ItemFeignService {
16 | @GetMapping("/{orderId}")
17 | JsonResult
> getItems(@PathVariable String orderId);
18 |
19 | @PostMapping("/decreaseNumber")
20 | JsonResult decreaseNumber(@RequestBody List- items);
21 | }
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/service/UserFeignService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.service;
2 |
3 | import org.springframework.cloud.openfeign.FeignClient;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RequestParam;
7 |
8 | import cn.tedu.sp01.pojo.User;
9 | import cn.tedu.web.util.JsonResult;
10 |
11 | @FeignClient(name="user-service", fallback = UserFeignServiceFB.class)
12 | public interface UserFeignService {
13 | @GetMapping("/{userId}")
14 | JsonResult getUser(@PathVariable Integer userId);
15 |
16 | // 拼接路径 /{userId}/score?score=新增积分
17 | // 如果请求参数和方法参数同名,@RequestParam可省略
18 | @GetMapping("/{userId}/score")
19 | JsonResult addScore(@PathVariable Integer userId, @RequestParam Integer score);
20 | }
--------------------------------------------------------------------------------
/sp09-feign/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: feign
4 |
5 | server:
6 | port: 3001
7 |
8 | eureka:
9 | client:
10 | service-url:
11 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 |
13 | ribbon:
14 | ConnectTimeout: 1000
15 | ReadTimeout: 1000
16 |
17 | item-service:
18 | ribbon:
19 | MaxAutoRetries: 1
20 | MaxAutoRetriesNextServer: 2
21 | ConnectTimeout: 1000
22 | ReadTimeout: 500
23 |
24 | feign:
25 | hystrix:
26 | enabled: true
27 |
28 | hystrix:
29 | command:
30 | default:
31 | execution:
32 | isolation:
33 | thread:
34 | timeoutInMilliseconds: 500
35 |
36 | management:
37 | endpoints:
38 | web:
39 | exposure:
40 | include: hystrix.stream
41 |
42 |
43 |
44 |
45 |
--------------------------------------------------------------------------------
/config/zuul-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: zuul
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 3001
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 | zuul:
22 | retryable: true
23 |
24 | ribbon:
25 | ConnectTimeout: 1000
26 | ReadTimeout: 1000
27 | MaxAutoRetriesNextServer: 1
28 | MaxAutoRetries: 1
29 |
30 | hystrix:
31 | command:
32 | default:
33 | execution:
34 | isolation:
35 | thread:
36 | timeoutInMilliseconds: 500
37 |
38 | management:
39 | endpoints:
40 | web:
41 | exposure:
42 | include: hystrix.stream
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feignclient/ItemFeignService.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.feignclient;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.cloud.openfeign.FeignClient;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestBody;
10 |
11 | import cn.tedu.sp01.pojo.Item;
12 | import cn.tedu.web.util.JsonResult;
13 |
14 | @FeignClient(name="item-service", fallback = ItemFeignServiceFB.class)
15 | public interface ItemFeignService {
16 | @GetMapping("/{orderId}")
17 | JsonResult
> getItems(@PathVariable String orderId);
18 |
19 | @PostMapping("/decreaseNumber")
20 | JsonResult decreaseNumber(@RequestBody List- items);
21 | }
--------------------------------------------------------------------------------
/sp12-config/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: config-server
4 | profiles:
5 | active: native
6 |
7 | cloud:
8 | config:
9 | server:
10 | native:
11 | search-locations: classpath:/config
12 |
13 | # git:
14 | # uri: https://github.com/你的用户路径/sp-config
15 | # searchPaths: config
16 | # username: your-username
17 | # password: your-password
18 |
19 |
20 | rabbitmq:
21 | host: 192.168.64.140
22 | port: 5672
23 | username: admin
24 | password: admin
25 |
26 |
27 | server:
28 | port: 6001
29 |
30 | eureka:
31 | client:
32 | service-url:
33 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
34 |
35 | management:
36 | endpoints:
37 | web:
38 | exposure:
39 | include: bus-refresh
--------------------------------------------------------------------------------
/sp12-config/src/main/resources/config/zuul-dev.yml:
--------------------------------------------------------------------------------
1 | spring:
2 | application:
3 | name: zuul
4 | cloud:
5 | config:
6 | override-none: true
7 | rabbitmq:
8 | host: 192.168.64.140
9 | port: 5672
10 | username: admin
11 | password: admin
12 |
13 | server:
14 | port: 3001
15 |
16 | eureka:
17 | client:
18 | service-url:
19 | defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
20 |
21 | zuul:
22 | retryable: true
23 |
24 | ribbon:
25 | ConnectTimeout: 1000
26 | ReadTimeout: 1000
27 | MaxAutoRetriesNextServer: 1
28 | MaxAutoRetries: 1
29 |
30 | hystrix:
31 | command:
32 | default:
33 | execution:
34 | isolation:
35 | thread:
36 | timeoutInMilliseconds: 500
37 |
38 | management:
39 | endpoints:
40 | web:
41 | exposure:
42 | include: hystrix.stream
--------------------------------------------------------------------------------
/sp11-zuul/src/main/resources/application.yml:
--------------------------------------------------------------------------------
1 | #spring:
2 | # application:
3 | # name: zuul
4 | #
5 | #server:
6 | # port: 3001
7 | #
8 | #eureka:
9 | # client:
10 | # service-url:
11 | # defaultZone: http://eureka1:2001/eureka, http://eureka2:2002/eureka
12 | #
13 | #zuul:
14 | # retryable: true
15 | #
16 | ## 默认配置,可以省略
17 | ## routes:
18 | ## item-service: /item-service/**
19 | ## user-service: /user-service/**
20 | ## order-service: /order-service/**
21 | #
22 | #ribbon:
23 | # ConnectTimeout: 1000
24 | # ReadTimeout: 1000
25 | # MaxAutoRetriesNextServer: 1
26 | # MaxAutoRetries: 1
27 | #
28 | #hystrix:
29 | # command:
30 | # default:
31 | # execution:
32 | # isolation:
33 | # thread:
34 | # timeoutInMilliseconds: 500
35 | #
36 | #management:
37 | # endpoints:
38 | # web:
39 | # exposure:
40 | # include: hystrix.stream
--------------------------------------------------------------------------------
/sp02-itemservice/src/main/java/cn/tedu/sp02/item/service/ItemServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp02.item.service;
2 |
3 | import java.util.ArrayList;
4 | import java.util.List;
5 |
6 | import org.springframework.stereotype.Service;
7 |
8 | import cn.tedu.sp01.pojo.Item;
9 | import cn.tedu.sp01.service.ItemService;
10 |
11 | import lombok.extern.slf4j.Slf4j;
12 |
13 | @Slf4j
14 | @Service
15 | public class ItemServiceImpl implements ItemService {
16 |
17 | @Override
18 | public List
- getItems(String orderId) {
19 | ArrayList
- list = new ArrayList
- ();
20 | list.add(new Item(1, "商品 1",1));
21 | list.add(new Item(2, "商品 2",2));
22 | list.add(new Item(3, "商品 3",3));
23 | list.add(new Item(4, "商品 4",4));
24 | list.add(new Item(5, "商品 5",5));
25 | return list;
26 | }
27 |
28 | @Override
29 | public void decreaseNumbers(List
- list) {
30 | for(Item item : list) {
31 | log.info("减少库存 - "+item);
32 | }
33 | }
34 | }
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/feignclient/ItemFeignServiceFB.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.feignclient;
2 |
3 | import java.util.Arrays;
4 | import java.util.List;
5 |
6 | import org.springframework.stereotype.Component;
7 |
8 | import cn.tedu.sp01.pojo.Item;
9 | import cn.tedu.web.util.JsonResult;
10 |
11 | @Component
12 | public class ItemFeignServiceFB implements ItemFeignService {
13 |
14 | @Override
15 | public JsonResult
> getItems(String orderId) {
16 | if(Math.random()<0.5) {
17 | return JsonResult.ok().data(
18 |
19 | Arrays.asList(new Item[] {
20 | new Item(1,"缓存aaa",2),
21 | new Item(2,"缓存bbb",1),
22 | new Item(3,"缓存ccc",3),
23 | new Item(4,"缓存ddd",1),
24 | new Item(5,"缓存eee",5)
25 | })
26 |
27 | );
28 | }
29 | return JsonResult.err("无法获取订单商品列表");
30 | }
31 |
32 | @Override
33 | public JsonResult decreaseNumber(List- items) {
34 | return JsonResult.err("无法修改商品库存");
35 | }
36 |
37 | }
--------------------------------------------------------------------------------
/sp07-hystrix/src/main/java/cn/tedu/sp06/Sp06RibbonApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06;
2 |
3 | import org.springframework.boot.SpringApplication;
4 | import org.springframework.cloud.client.SpringCloudApplication;
5 | import org.springframework.cloud.client.loadbalancer.LoadBalanced;
6 | import org.springframework.context.annotation.Bean;
7 | import org.springframework.http.client.SimpleClientHttpRequestFactory;
8 | import org.springframework.web.client.RestTemplate;
9 |
10 | //@EnableCircuitBreaker
11 | //@EnableDiscoveryClient
12 | //@SpringBootApplication
13 |
14 | @SpringCloudApplication
15 | public class Sp06RibbonApplication {
16 |
17 | //创建 RestTemplate 实例,并存入 spring 容器
18 | @LoadBalanced //负载均衡注解
19 | @Bean
20 | public RestTemplate getRestTemplate() {
21 | SimpleClientHttpRequestFactory f = new SimpleClientHttpRequestFactory();
22 | f.setConnectTimeout(1000);
23 | f.setReadTimeout(1000);
24 | return new RestTemplate(f);
25 |
26 | //return new RestTemplate();
27 | }
28 |
29 | public static void main(String[] args) {
30 | SpringApplication.run(Sp06RibbonApplication.class, args);
31 | }
32 |
33 | }
34 |
--------------------------------------------------------------------------------
/sp06-ribbon/src/main/java/cn/tedu/sp06/Sp06RibbonApplication.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06;
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.http.client.SimpleClientHttpRequestFactory;
9 | import org.springframework.web.client.RestTemplate;
10 |
11 | @EnableDiscoveryClient
12 | @SpringBootApplication
13 | public class Sp06RibbonApplication {
14 |
15 | //创建 RestTemplate 实例,并存入 spring 容器
16 | @LoadBalanced //负载均衡注解
17 | @Bean
18 | public RestTemplate getRestTemplate() {
19 | SimpleClientHttpRequestFactory f = new SimpleClientHttpRequestFactory();
20 | f.setConnectTimeout(1000);
21 | f.setReadTimeout(1000);
22 | return new RestTemplate(f);
23 |
24 | //return new RestTemplate();
25 | }
26 |
27 | public static void main(String[] args) {
28 | SpringApplication.run(Sp06RibbonApplication.class, args);
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/sp03-userservice/src/main/java/cn/tedu/sp03/user/controller/UserController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp03.user.controller;
2 |
3 | import org.springframework.beans.factory.annotation.Autowired;
4 | import org.springframework.web.bind.annotation.GetMapping;
5 | import org.springframework.web.bind.annotation.PathVariable;
6 | import org.springframework.web.bind.annotation.RestController;
7 |
8 | import cn.tedu.sp01.pojo.User;
9 | import cn.tedu.sp01.service.UserService;
10 | import cn.tedu.web.util.JsonResult;
11 |
12 | import lombok.extern.slf4j.Slf4j;
13 |
14 | @Slf4j
15 | @RestController
16 | public class UserController {
17 |
18 | @Autowired
19 | private UserService userService;
20 |
21 | @GetMapping("/{userId}")
22 | public JsonResult getUser(@PathVariable Integer userId) {
23 | log.info("get user, userId="+userId);
24 | User u = userService.getUser(userId);
25 | return JsonResult.ok(u);
26 | }
27 |
28 | @GetMapping("/{userId}/score")
29 | public JsonResult addScore(
30 | @PathVariable Integer userId, Integer score) {
31 | userService.addScore(userId, score);
32 | return JsonResult.ok();
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/sp01-commons/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/sp03-userservice/src/main/java/cn/tedu/sp03/user/service/UserServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp03.user.service;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Value;
6 | import org.springframework.cloud.context.config.annotation.RefreshScope;
7 | import org.springframework.stereotype.Service;
8 |
9 | import com.fasterxml.jackson.core.type.TypeReference;
10 | import cn.tedu.sp01.pojo.User;
11 | import cn.tedu.sp01.service.UserService;
12 | import cn.tedu.web.util.JsonUtil;
13 |
14 | import lombok.extern.slf4j.Slf4j;
15 |
16 | @RefreshScope
17 | @Slf4j
18 | @Service
19 | public class UserServiceImpl implements UserService {
20 | @Value("${sp.user-service.users}")
21 | private String userJson;
22 |
23 | @Override
24 | public User getUser(Integer id) {
25 | log.info("users json string : "+userJson);
26 | List list = JsonUtil.from(userJson, new TypeReference
>() {});
27 | for (User u : list) {
28 | if (u.getId().equals(id)) {
29 | return u;
30 | }
31 | }
32 |
33 | return new User(id, "name-"+id, "pwd-"+id);
34 | }
35 |
36 | @Override
37 | public void addScore(Integer id, Integer score) {
38 | // 这里增加积分
39 | log.info("user "+id+" - 增加积分 "+score);
40 | }
41 |
42 | }
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/controller/OrderController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.controller;
2 |
3 | import java.util.Arrays;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.RestController;
9 |
10 | import cn.tedu.sp01.pojo.Item;
11 | import cn.tedu.sp01.pojo.Order;
12 | import cn.tedu.sp01.pojo.User;
13 | import cn.tedu.sp01.service.OrderService;
14 | import cn.tedu.web.util.JsonResult;
15 |
16 | import lombok.extern.slf4j.Slf4j;
17 |
18 | @Slf4j
19 | @RestController
20 | public class OrderController {
21 | @Autowired
22 | private OrderService orderService;
23 |
24 | @GetMapping("/{orderId}")
25 | public JsonResult getOrder(@PathVariable String orderId) {
26 | log.info("get order, id="+orderId);
27 |
28 | Order order = orderService.getOrder(orderId);
29 | return JsonResult.ok(order);
30 | }
31 |
32 | @GetMapping("/")
33 | public JsonResult addOrder() {
34 | //模拟post提交的数据
35 | Order order = new Order();
36 | order.setId("123abc");
37 | order.setUser(new User(7,null,null));
38 | order.setItems(Arrays.asList(new Item[] {
39 | new Item(1,"aaa",2),
40 | new Item(2,"bbb",1),
41 | new Item(3,"ccc",3),
42 | new Item(4,"ddd",1),
43 | new Item(5,"eee",5),
44 | }));
45 | orderService.addOrder(order);
46 | return JsonResult.ok();
47 | }
48 | }
--------------------------------------------------------------------------------
/sp04-orderservice/src/main/java/cn/tedu/sp04/order/service/OrderServiceImpl.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp04.order.service;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.stereotype.Service;
7 |
8 | import cn.tedu.sp01.pojo.Item;
9 | import cn.tedu.sp01.pojo.Order;
10 | import cn.tedu.sp01.pojo.User;
11 | import cn.tedu.sp01.service.OrderService;
12 | import cn.tedu.sp04.order.feignclient.ItemFeignService;
13 | import cn.tedu.sp04.order.feignclient.UserFeignService;
14 | import cn.tedu.web.util.JsonResult;
15 |
16 | import lombok.extern.slf4j.Slf4j;
17 |
18 | @Slf4j
19 | @Service
20 | public class OrderServiceImpl implements OrderService {
21 |
22 | @Autowired
23 | private ItemFeignService itemService;
24 | @Autowired
25 | private UserFeignService userService;
26 |
27 | @Override
28 | public Order getOrder(String orderId) {
29 | //调用user-service获取用户信息
30 | JsonResult user = userService.getUser(7);
31 |
32 | //调用item-service获取商品信息
33 | JsonResult> items = itemService.getItems(orderId);
34 |
35 |
36 | Order order = new Order();
37 | order.setId(orderId);
38 | order.setUser(user.getData());
39 | order.setItems(items.getData());
40 | return order;
41 | }
42 |
43 | @Override
44 | public void addOrder(Order order) {
45 | //调用item-service减少商品库存
46 | itemService.decreaseNumber(order.getItems());
47 |
48 | //调用user-service增加用户积分
49 | userService.addScore(order.getUser().getId(), 100);
50 |
51 | log.info("保存订单:"+order);
52 | }
53 |
54 | }
--------------------------------------------------------------------------------
/sp11-zuul/src/main/java/cn/tedu/sp11/filter/AccessFilter.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp11.filter;
2 |
3 | import javax.servlet.http.HttpServletRequest;
4 |
5 | import org.springframework.cloud.netflix.zuul.filters.support.FilterConstants;
6 | import org.springframework.stereotype.Component;
7 |
8 | import com.netflix.zuul.ZuulFilter;
9 | import com.netflix.zuul.context.RequestContext;
10 | import com.netflix.zuul.exception.ZuulException;
11 | import cn.tedu.web.util.JsonResult;
12 |
13 | @Component
14 | public class AccessFilter extends ZuulFilter{
15 | @Override
16 | public boolean shouldFilter() {
17 | //对指定的serviceid过滤,如果要过滤所有服务,直接返回 true
18 |
19 | RequestContext ctx = RequestContext.getCurrentContext();
20 | String serviceId = (String) ctx.get(FilterConstants.SERVICE_ID_KEY);
21 | if(serviceId.equals("item-service")) {
22 | return true;
23 | }
24 | return false;
25 | }
26 |
27 | @Override
28 | public Object run() throws ZuulException {
29 | RequestContext ctx = RequestContext.getCurrentContext();
30 | HttpServletRequest req = ctx.getRequest();
31 | String token = req.getParameter("token");
32 | if (token == null) {
33 | //此设置会阻止请求被路由到后台微服务
34 | ctx.setSendZuulResponse(false);
35 | //向客户端的响应
36 | ctx.setResponseStatusCode(200);
37 | ctx.setResponseBody(JsonResult.err().code(JsonResult.NOT_LOGIN).toString());
38 | }
39 | //zuul过滤器返回的数据设计为以后扩展使用,
40 | //目前该返回值没有被使用
41 | return null;
42 | }
43 |
44 | @Override
45 | public String filterType() {
46 | return FilterConstants.PRE_TYPE;
47 | }
48 |
49 | @Override
50 | public int filterOrder() {
51 | //该过滤器顺序要 > 5,才能得到 serviceid
52 | return FilterConstants.PRE_DECORATION_FILTER_ORDER+1;
53 | }
54 | }
--------------------------------------------------------------------------------
/sp02-itemservice/src/main/java/cn/tedu/sp02/item/controller/ItemController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp02.item.controller;
2 |
3 | import java.util.List;
4 | import java.util.Random;
5 |
6 | import org.springframework.beans.factory.annotation.Autowired;
7 | import org.springframework.beans.factory.annotation.Value;
8 | import org.springframework.web.bind.annotation.GetMapping;
9 | import org.springframework.web.bind.annotation.PathVariable;
10 | import org.springframework.web.bind.annotation.PostMapping;
11 | import org.springframework.web.bind.annotation.RequestBody;
12 | import org.springframework.web.bind.annotation.RestController;
13 |
14 | import cn.tedu.sp01.pojo.Item;
15 | import cn.tedu.sp01.service.ItemService;
16 | import cn.tedu.web.util.JsonResult;
17 | import lombok.extern.slf4j.Slf4j;
18 |
19 | @Slf4j
20 | @RestController
21 | public class ItemController {
22 | @Autowired
23 | private ItemService itemService;
24 |
25 | @Value("${server.port}")
26 | private int port;
27 |
28 | @GetMapping("/{orderId}")
29 | public JsonResult> getItems(@PathVariable String orderId) throws Exception {
30 | log.info("server.port="+port+", orderId="+orderId);
31 |
32 | ///--设置随机延迟
33 | if(Math.random()<0.6) {
34 | long t = new Random().nextInt(5000);
35 | log.info("item-service-"+port+" - 暂停 "+t);
36 | Thread.sleep(t);
37 | }
38 | ///~~
39 |
40 | List- items = itemService.getItems(orderId);
41 | return JsonResult.ok(items).msg("port="+port);
42 | }
43 |
44 | @PostMapping("/decreaseNumber")
45 | public JsonResult decreaseNumber(@RequestBody List
- items) {
46 | itemService.decreaseNumbers(items);
47 | return JsonResult.ok();
48 | }
49 | }
--------------------------------------------------------------------------------
/sp01-commons/src/main/java/cn/tedu/web/util/CookieUtil.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.web.util;
2 |
3 | import javax.servlet.http.Cookie;
4 | import javax.servlet.http.HttpServletRequest;
5 | import javax.servlet.http.HttpServletResponse;
6 |
7 | public class CookieUtil {
8 |
9 | /**
10 | * @param response
11 | * @param name
12 | * @param value
13 | * @param maxAge
14 | */
15 | public static void setCookie(HttpServletResponse response,
16 | String name, String value, String domain, String path, int maxAge) {
17 | Cookie cookie = new Cookie(name, value);
18 | if(domain != null) {
19 | cookie.setDomain(domain);
20 | }
21 | cookie.setPath(path);
22 | cookie.setMaxAge(maxAge);
23 | response.addCookie(cookie);
24 | }
25 | public static void setCookie(HttpServletResponse response, String name, String value, int maxAge) {
26 | setCookie(response, name, value, null, "/", maxAge);
27 | }
28 | public static void setCookie(HttpServletResponse response, String name, String value) {
29 | setCookie(response, name, value, null, "/", 3600);
30 | }
31 | public static void setCookie(HttpServletResponse response, String name) {
32 | setCookie(response, name, "", null, "/", 3600);
33 | }
34 |
35 | /**
36 | * @param request
37 | * @param name
38 | * @return
39 | */
40 | public static String getCookie(HttpServletRequest request, String name) {
41 | String value = null;
42 | Cookie[] cookies = request.getCookies();
43 | if (null != cookies) {
44 | for (Cookie cookie : cookies) {
45 | if (cookie.getName().equals(name)) {
46 | value = cookie.getValue();
47 | }
48 | }
49 | }
50 | return value;
51 | }
52 |
53 | /**
54 | * @param response
55 | * @param name
56 | * @return
57 | */
58 | public static void removeCookie(HttpServletResponse response, String name, String domain, String path) {
59 | setCookie(response, name, "", domain, path, 0);
60 | }
61 |
62 | }
--------------------------------------------------------------------------------
/sp05-eureka/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 | cn.tedu
12 | sp05-eureka
13 | 0.0.1-SNAPSHOT
14 | sp05-eureka
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-starter-netflix-eureka-server
26 |
27 |
28 |
29 | org.springframework.boot
30 | spring-boot-starter-test
31 | test
32 |
33 |
34 | org.junit.vintage
35 | junit-vintage-engine
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 | org.springframework.cloud
45 | spring-cloud-dependencies
46 | ${spring-cloud.version}
47 | pom
48 | import
49 |
50 |
51 |
52 |
53 |
54 |
55 |
56 | org.springframework.boot
57 | spring-boot-maven-plugin
58 |
59 |
60 |
61 |
62 |
63 |
--------------------------------------------------------------------------------
/sp09-feign/src/main/java/cn/tedu/sp09/controller/FeignController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp09.controller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestBody;
10 | import org.springframework.web.bind.annotation.RestController;
11 |
12 | import cn.tedu.sp01.pojo.Item;
13 | import cn.tedu.sp01.pojo.Order;
14 | import cn.tedu.sp01.pojo.User;
15 | import cn.tedu.sp09.service.ItemFeignService;
16 | import cn.tedu.sp09.service.OrderFeignService;
17 | import cn.tedu.sp09.service.UserFeignService;
18 | import cn.tedu.web.util.JsonResult;
19 |
20 | @RestController
21 | public class FeignController {
22 | @Autowired
23 | private ItemFeignService itemService;
24 | @Autowired
25 | private UserFeignService userService;
26 | @Autowired
27 | private OrderFeignService orderService;
28 |
29 | @GetMapping("/item-service/{orderId}")
30 | public JsonResult
> getItems(@PathVariable String orderId) {
31 | return itemService.getItems(orderId);
32 | }
33 |
34 | @PostMapping("/item-service/decreaseNumber")
35 | public JsonResult decreaseNumber(@RequestBody List- items) {
36 | return itemService.decreaseNumber(items);
37 | }
38 |
39 | /////////////////////////////////////////
40 |
41 | @GetMapping("/user-service/{userId}")
42 | public JsonResult getUser(@PathVariable Integer userId) {
43 | return userService.getUser(userId);
44 | }
45 |
46 | @GetMapping("/user-service/{userId}/score")
47 | public JsonResult addScore(@PathVariable Integer userId, Integer score) {
48 | return userService.addScore(userId, score);
49 | }
50 |
51 | /////////////////////////////////////////
52 |
53 | @GetMapping("/order-service/{orderId}")
54 | public JsonResult getOrder(@PathVariable String orderId) {
55 | return orderService.getOrder(orderId);
56 | }
57 |
58 | @GetMapping("/order-service")
59 | public JsonResult addOrder() {
60 | return orderService.addOrder();
61 | }
62 | }
--------------------------------------------------------------------------------
/sp10-turbine/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 | cn.tedu
12 | sp10-turbine
13 | 0.0.1-SNAPSHOT
14 | sp10-turbine
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-starter-netflix-eureka-client
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-turbine
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.cloud
49 | spring-cloud-dependencies
50 | ${spring-cloud.version}
51 | pom
52 | import
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-maven-plugin
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/sp11-zuul/src/main/java/cn/tedu/sp11/fallback/OrderServiceFallback.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp11.fallback;
2 |
3 | import java.io.ByteArrayInputStream;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | import org.springframework.cloud.netflix.zuul.filters.route.FallbackProvider;
8 | import org.springframework.http.HttpHeaders;
9 | import org.springframework.http.HttpStatus;
10 | import org.springframework.http.MediaType;
11 | import org.springframework.http.client.ClientHttpResponse;
12 | import org.springframework.stereotype.Component;
13 |
14 | import cn.tedu.web.util.JsonResult;
15 |
16 | import lombok.extern.slf4j.Slf4j;
17 |
18 | @Slf4j
19 | @Component
20 | public class OrderServiceFallback implements FallbackProvider {
21 | @Override
22 | public String getRoute() {
23 | return "order-service"; //"*"; //null;
24 | }
25 |
26 | @Override
27 | public ClientHttpResponse fallbackResponse(String route, Throwable cause) {
28 | return response();
29 | }
30 |
31 | private ClientHttpResponse response() {
32 | return new ClientHttpResponse() {
33 | @Override
34 | public HttpStatus getStatusCode() throws IOException {
35 | return HttpStatus.OK;
36 | }
37 | @Override
38 | public int getRawStatusCode() throws IOException {
39 | return HttpStatus.OK.value();
40 | }
41 | @Override
42 | public String getStatusText() throws IOException {
43 | return HttpStatus.OK.getReasonPhrase();
44 | }
45 |
46 | @Override
47 | public void close() {
48 | }
49 |
50 | @Override
51 | public InputStream getBody() throws IOException {
52 | log.info("fallback body");
53 | String s = JsonResult.err().msg("后台服务错误").toString();
54 | return new ByteArrayInputStream(s.getBytes("UTF-8"));
55 | }
56 |
57 | @Override
58 | public HttpHeaders getHeaders() {
59 | HttpHeaders headers = new HttpHeaders();
60 | headers.setContentType(MediaType.APPLICATION_JSON);
61 | return headers;
62 | }
63 | };
64 | }
65 | }
--------------------------------------------------------------------------------
/sp01-commons/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | cn.tedu
6 | sp01-commons
7 | 0.0.1-SNAPSHOT
8 | sp01-commons
9 |
10 |
11 | com.fasterxml.jackson.module
12 | jackson-module-parameter-names
13 | 2.9.8
14 |
15 |
16 | com.fasterxml.jackson.datatype
17 | jackson-datatype-jdk8
18 | 2.9.8
19 |
20 |
21 | com.fasterxml.jackson.datatype
22 | jackson-datatype-jsr310
23 | 2.9.8
24 |
25 |
26 | com.fasterxml.jackson.datatype
27 | jackson-datatype-guava
28 | 2.9.8
29 |
30 |
31 |
32 | org.projectlombok
33 | lombok
34 | 1.18.6
35 |
36 |
37 | javax.servlet
38 | javax.servlet-api
39 | 3.1.0
40 |
41 |
42 | org.slf4j
43 | slf4j-api
44 | 1.7.26
45 |
46 |
47 | org.apache.commons
48 | commons-lang3
49 | 3.9
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | org.apache.maven.plugins
58 | maven-compiler-plugin
59 | 3.8.0
60 |
61 | 1.8
62 | 1.8
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/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 | cn.tedu
12 | sp08-hystrix-dashboard
13 | 0.0.1-SNAPSHOT
14 | sp08-hystrix-dashboard
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-starter-netflix-eureka-client
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-hystrix-dashboard
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 | org.springframework.cloud
49 | spring-cloud-dependencies
50 | ${spring-cloud.version}
51 | pom
52 | import
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-maven-plugin
62 |
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/sp06-ribbon/src/main/java/cn/tedu/sp06/consoller/RibbonController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06.consoller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestBody;
10 | import org.springframework.web.bind.annotation.RestController;
11 | import org.springframework.web.client.RestTemplate;
12 |
13 | import cn.tedu.sp01.pojo.Item;
14 | import cn.tedu.sp01.pojo.Order;
15 | import cn.tedu.sp01.pojo.User;
16 | import cn.tedu.web.util.JsonResult;
17 |
18 | @RestController
19 | public class RibbonController {
20 | @Autowired
21 | private RestTemplate rt;
22 |
23 | @GetMapping("/item-service/{orderId}")
24 | public JsonResult
> getItems(@PathVariable String orderId) {
25 | //这里服务器路径用 service-id 代替,ribbon 会向服务的多台集群服务器分发请求
26 | return rt.getForObject("http://item-service/{1}", JsonResult.class, orderId);
27 | }
28 |
29 | @PostMapping("/item-service/decreaseNumber")
30 | public JsonResult decreaseNumber(@RequestBody List- items) {
31 | return rt.postForObject("http://item-service/decreaseNumber", items, JsonResult.class);
32 | }
33 |
34 | /////////////////////////////////////////
35 |
36 | @GetMapping("/user-service/{userId}")
37 | public JsonResult getUser(@PathVariable Integer userId) {
38 | return rt.getForObject("http://user-service/{1}", JsonResult.class, userId);
39 | }
40 |
41 | @GetMapping("/user-service/{userId}/score")
42 | public JsonResult addScore(
43 | @PathVariable Integer userId, Integer score) {
44 | return rt.getForObject("http://user-service/{1}/score?score={2}", JsonResult.class, userId, score);
45 | }
46 |
47 | /////////////////////////////////////////
48 |
49 | @GetMapping("/order-service/{orderId}")
50 | public JsonResult getOrder(@PathVariable String orderId) {
51 | return rt.getForObject("http://order-service/{1}", JsonResult.class, orderId);
52 | }
53 |
54 | @GetMapping("/order-service")
55 | public JsonResult addOrder() {
56 | return rt.getForObject("http://order-service/", JsonResult.class);
57 | }
58 | }
--------------------------------------------------------------------------------
/sp01-commons/target/classes/META-INF/maven/cn.tedu/sp01-commons/pom.xml:
--------------------------------------------------------------------------------
1 |
4 | 4.0.0
5 | cn.tedu
6 | sp01-commons
7 | 0.0.1-SNAPSHOT
8 | sp01-commons
9 |
10 |
11 | com.fasterxml.jackson.module
12 | jackson-module-parameter-names
13 | 2.9.8
14 |
15 |
16 | com.fasterxml.jackson.datatype
17 | jackson-datatype-jdk8
18 | 2.9.8
19 |
20 |
21 | com.fasterxml.jackson.datatype
22 | jackson-datatype-jsr310
23 | 2.9.8
24 |
25 |
26 | com.fasterxml.jackson.datatype
27 | jackson-datatype-guava
28 | 2.9.8
29 |
30 |
31 |
32 | org.projectlombok
33 | lombok
34 | 1.18.6
35 |
36 |
37 | javax.servlet
38 | javax.servlet-api
39 | 3.1.0
40 |
41 |
42 | org.slf4j
43 | slf4j-api
44 | 1.7.26
45 |
46 |
47 | org.apache.commons
48 | commons-lang3
49 | 3.9
50 |
51 |
52 |
53 |
54 |
55 |
56 |
57 | org.apache.maven.plugins
58 | maven-compiler-plugin
59 | 3.8.0
60 |
61 | 1.8
62 | 1.8
63 |
64 |
65 |
66 |
67 |
--------------------------------------------------------------------------------
/sp11-zuul/src/main/java/cn/tedu/sp11/fallback/ItemServiceFallback.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp11.fallback;
2 |
3 | import java.io.ByteArrayInputStream;
4 | import java.io.IOException;
5 | import java.io.InputStream;
6 |
7 | import org.springframework.cloud.netflix.zuul.filters.route.FallbackProvider;
8 | import org.springframework.http.HttpHeaders;
9 | import org.springframework.http.HttpStatus;
10 | import org.springframework.http.MediaType;
11 | import org.springframework.http.client.ClientHttpResponse;
12 | import org.springframework.stereotype.Component;
13 |
14 | import cn.tedu.web.util.JsonResult;
15 |
16 | import lombok.extern.slf4j.Slf4j;
17 |
18 | @Slf4j
19 | @Component
20 | public class ItemServiceFallback implements FallbackProvider {
21 | @Override
22 | public String getRoute() {
23 | //当执行item-service失败,
24 | //应用当前这个降级类
25 | return "item-service";
26 | //星号和null都表示所有微服务失败都应用当前降级类
27 | //"*"; //null;
28 | }
29 |
30 | //该方法返回封装降级响应的对象
31 | //ClientHttpResponse中封装降级响应
32 | @Override
33 | public ClientHttpResponse fallbackResponse(String route, Throwable cause) {
34 | return response();
35 | }
36 |
37 | private ClientHttpResponse response() {
38 | return new ClientHttpResponse() {
39 | //下面三个方法都是协议号
40 | @Override
41 | public HttpStatus getStatusCode() throws IOException {
42 | return HttpStatus.OK;
43 | }
44 | @Override
45 | public int getRawStatusCode() throws IOException {
46 | return HttpStatus.OK.value();
47 | }
48 | @Override
49 | public String getStatusText() throws IOException {
50 | return HttpStatus.OK.getReasonPhrase();
51 | }
52 |
53 | @Override
54 | public void close() {
55 | }
56 |
57 | @Override
58 | public InputStream getBody() throws IOException {
59 | log.info("fallback body");
60 | String s = JsonResult.err().msg("后台服务错误").toString();
61 | return new ByteArrayInputStream(s.getBytes("UTF-8"));
62 | }
63 |
64 | @Override
65 | public HttpHeaders getHeaders() {
66 | HttpHeaders headers = new HttpHeaders();
67 | headers.setContentType(MediaType.APPLICATION_JSON);
68 | return headers;
69 | }
70 | };
71 | }
72 | }
--------------------------------------------------------------------------------
/sp06-ribbon/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 | cn.tedu
12 | sp06-ribbon
13 | 0.0.1-SNAPSHOT
14 | sp06-ribbon
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-web
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-eureka-client
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 | cn.tedu
45 | sp01-commons
46 | 0.0.1-SNAPSHOT
47 |
48 |
49 |
50 | org.springframework.retry
51 | spring-retry
52 |
53 |
54 |
55 |
56 |
57 |
58 | org.springframework.cloud
59 | spring-cloud-dependencies
60 | ${spring-cloud.version}
61 | pom
62 | import
63 |
64 |
65 |
66 |
67 |
68 |
69 |
70 | org.springframework.boot
71 | spring-boot-maven-plugin
72 |
73 |
74 |
75 |
76 |
77 |
--------------------------------------------------------------------------------
/sp12-config/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 | cn.tedu
12 | sp12-config
13 | 0.0.1-SNAPSHOT
14 | sp12-config
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-config-server
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-eureka-client
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 | org.springframework.boot
45 | spring-boot-starter-amqp
46 |
47 |
48 | org.springframework.cloud
49 | spring-cloud-bus
50 |
51 |
52 | org.springframework.cloud
53 | spring-cloud-stream-binder-rabbit
54 |
55 |
56 | org.springframework.amqp
57 | spring-rabbit-test
58 | test
59 |
60 |
61 |
62 |
63 |
64 |
65 | org.springframework.cloud
66 | spring-cloud-dependencies
67 | ${spring-cloud.version}
68 | pom
69 | import
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | org.springframework.boot
78 | spring-boot-maven-plugin
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/sp07-hystrix/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 | cn.tedu
12 | sp07-hystrix
13 | 0.0.1-SNAPSHOT
14 | sp07-hystrix
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-web
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-eureka-client
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 | cn.tedu
45 | sp01-commons
46 | 0.0.1-SNAPSHOT
47 |
48 |
49 |
50 | org.springframework.retry
51 | spring-retry
52 |
53 |
54 | org.springframework.cloud
55 |
56 | spring-cloud-starter-netflix-hystrix
57 |
58 |
59 |
60 | org.springframework.boot
61 | spring-boot-starter-actuator
62 |
63 |
64 |
65 |
66 |
67 |
68 | org.springframework.cloud
69 | spring-cloud-dependencies
70 | ${spring-cloud.version}
71 | pom
72 | import
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 | org.springframework.boot
81 | spring-boot-maven-plugin
82 |
83 |
84 |
85 |
86 |
87 |
--------------------------------------------------------------------------------
/sp09-feign/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 | cn.tedu
12 | sp09-feign
13 | 0.0.1-SNAPSHOT
14 | sp09-feign
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.boot
25 | spring-boot-starter-actuator
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-web
30 |
31 |
32 | org.springframework.cloud
33 | spring-cloud-starter-netflix-eureka-client
34 |
35 |
36 | org.springframework.cloud
37 | spring-cloud-starter-openfeign
38 |
39 |
40 |
41 | org.springframework.boot
42 | spring-boot-starter-test
43 | test
44 |
45 |
46 | org.junit.vintage
47 | junit-vintage-engine
48 |
49 |
50 |
51 |
52 | cn.tedu
53 | sp01-commons
54 | 0.0.1-SNAPSHOT
55 |
56 |
57 | org.springframework.cloud
58 |
59 | spring-cloud-starter-netflix-hystrix
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 | org.springframework.cloud
68 | spring-cloud-dependencies
69 | ${spring-cloud.version}
70 | pom
71 | import
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 | org.springframework.boot
80 | spring-boot-maven-plugin
81 |
82 |
83 |
84 |
85 |
86 |
--------------------------------------------------------------------------------
/sp07-hystrix/src/main/java/cn/tedu/sp06/consoller/RibbonController.java:
--------------------------------------------------------------------------------
1 | package cn.tedu.sp06.consoller;
2 |
3 | import java.util.List;
4 |
5 | import org.springframework.beans.factory.annotation.Autowired;
6 | import org.springframework.web.bind.annotation.GetMapping;
7 | import org.springframework.web.bind.annotation.PathVariable;
8 | import org.springframework.web.bind.annotation.PostMapping;
9 | import org.springframework.web.bind.annotation.RequestBody;
10 | import org.springframework.web.bind.annotation.RestController;
11 | import org.springframework.web.client.RestTemplate;
12 |
13 | import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
14 | import cn.tedu.sp01.pojo.Item;
15 | import cn.tedu.sp01.pojo.Order;
16 | import cn.tedu.sp01.pojo.User;
17 | import cn.tedu.web.util.JsonResult;
18 |
19 | @RestController
20 | public class RibbonController {
21 | @Autowired
22 | private RestTemplate rt;
23 |
24 | @GetMapping("/item-service/{orderId}")
25 | @HystrixCommand(fallbackMethod = "getItemsFB") //指定降级方法的方法名
26 | public JsonResult
> getItems(@PathVariable String orderId) {
27 | return rt.getForObject("http://item-service/{1}", JsonResult.class, orderId);
28 | }
29 |
30 | @PostMapping("/item-service/decreaseNumber")
31 | @HystrixCommand(fallbackMethod = "decreaseNumberFB")
32 | public JsonResult decreaseNumber(@RequestBody List- items) {
33 | return rt.postForObject("http://item-service/decreaseNumber", items, JsonResult.class);
34 | }
35 |
36 | /////////////////////////////////////////
37 |
38 | @GetMapping("/user-service/{userId}")
39 | @HystrixCommand(fallbackMethod = "getUserFB")
40 | public JsonResult getUser(@PathVariable Integer userId) {
41 | return rt.getForObject("http://user-service/{1}", JsonResult.class, userId);
42 | }
43 |
44 | @GetMapping("/user-service/{userId}/score")
45 | @HystrixCommand(fallbackMethod = "addScoreFB")
46 | public JsonResult addScore(@PathVariable Integer userId, Integer score) {
47 | return rt.getForObject("http://user-service/{1}/score?score={2}", JsonResult.class, userId, score);
48 | }
49 |
50 | /////////////////////////////////////////
51 |
52 | @GetMapping("/order-service/{orderId}")
53 | @HystrixCommand(fallbackMethod = "getOrderFB")
54 | public JsonResult getOrder(@PathVariable String orderId) {
55 | return rt.getForObject("http://order-service/{1}", JsonResult.class, orderId);
56 | }
57 |
58 | @GetMapping("/order-service")
59 | @HystrixCommand(fallbackMethod = "addOrderFB")
60 | public JsonResult addOrder() {
61 | return rt.getForObject("http://order-service/", JsonResult.class);
62 | }
63 |
64 | /////////////////////////////////////////
65 |
66 | //降级方法的参数和返回值,需要和原始方法一致,方法名任意
67 | public JsonResult
> getItemsFB(String orderId) {
68 | return JsonResult.err("获取订单商品列表失败");
69 | }
70 | public JsonResult decreaseNumberFB(List- items) {
71 | return JsonResult.err("更新商品库存失败");
72 | }
73 | public JsonResult getUserFB(Integer userId) {
74 | return JsonResult.err("获取用户信息失败");
75 | }
76 | public JsonResult addScoreFB(Integer userId, Integer score) {
77 | return JsonResult.err("增加用户积分失败");
78 | }
79 | public JsonResult getOrderFB(String orderId) {
80 | return JsonResult.err("获取订单失败");
81 | }
82 | public JsonResult addOrderFB() {
83 | return JsonResult.err("添加订单失败");
84 | }
85 | }
--------------------------------------------------------------------------------
/sp02-itemservice/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 | cn.tedu
12 | sp02-itemservice
13 | 0.0.1-SNAPSHOT
14 | sp02-itemservice
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-test
30 | test
31 |
32 |
33 | org.junit.vintage
34 | junit-vintage-engine
35 |
36 |
37 |
38 |
39 | cn.tedu
40 | sp01-commons
41 | 0.0.1-SNAPSHOT
42 |
43 |
44 | org.springframework.cloud
45 |
46 | spring-cloud-starter-netflix-eureka-client
47 |
48 |
49 |
50 | org.springframework.cloud
51 | spring-cloud-starter-config
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-amqp
56 |
57 |
58 | org.springframework.cloud
59 | spring-cloud-bus
60 |
61 |
62 | org.springframework.cloud
63 | spring-cloud-stream-binder-rabbit
64 |
65 |
66 | org.springframework.amqp
67 | spring-rabbit-test
68 | test
69 |
70 |
71 | org.springframework.cloud
72 | spring-cloud-starter-sleuth
73 |
74 |
75 | org.springframework.cloud
76 | spring-cloud-starter-zipkin
77 |
78 |
79 |
80 |
81 |
82 |
83 | org.springframework.boot
84 | spring-boot-maven-plugin
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 | org.springframework.cloud
93 | spring-cloud-dependencies
94 | Hoxton.RELEASE
95 | pom
96 | import
97 |
98 |
99 |
100 |
--------------------------------------------------------------------------------
/sp03-userservice/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 | cn.tedu
12 | sp03-userservice
13 | 0.0.1-SNAPSHOT
14 | sp03-userservice
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-test
30 | test
31 |
32 |
33 | org.junit.vintage
34 | junit-vintage-engine
35 |
36 |
37 |
38 |
39 | cn.tedu
40 | sp01-commons
41 | 0.0.1-SNAPSHOT
42 |
43 |
44 | org.springframework.cloud
45 |
46 | spring-cloud-starter-netflix-eureka-client
47 |
48 |
49 |
50 | org.springframework.cloud
51 | spring-cloud-starter-config
52 |
53 |
54 | org.springframework.boot
55 | spring-boot-starter-actuator
56 |
57 |
58 | org.springframework.boot
59 | spring-boot-starter-amqp
60 |
61 |
62 | org.springframework.cloud
63 | spring-cloud-bus
64 |
65 |
66 | org.springframework.cloud
67 | spring-cloud-stream-binder-rabbit
68 |
69 |
70 | org.springframework.amqp
71 | spring-rabbit-test
72 | test
73 |
74 |
75 | org.springframework.cloud
76 | spring-cloud-starter-sleuth
77 |
78 |
79 | org.springframework.cloud
80 | spring-cloud-starter-zipkin
81 |
82 |
83 |
84 |
85 |
86 |
87 | org.springframework.boot
88 | spring-boot-maven-plugin
89 |
90 |
91 |
92 |
93 |
94 |
95 |
96 | org.springframework.cloud
97 | spring-cloud-dependencies
98 | Hoxton.RELEASE
99 | pom
100 | import
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/sp11-zuul/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 | cn.tedu
12 | sp11-zuul
13 | 0.0.1-SNAPSHOT
14 | sp11-zuul
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 | Hoxton.RELEASE
20 |
21 |
22 |
23 |
24 | org.springframework.cloud
25 | spring-cloud-starter-netflix-eureka-client
26 |
27 |
28 | org.springframework.cloud
29 | spring-cloud-starter-netflix-zuul
30 |
31 |
32 |
33 | org.springframework.boot
34 | spring-boot-starter-test
35 | test
36 |
37 |
38 | org.junit.vintage
39 | junit-vintage-engine
40 |
41 |
42 |
43 |
44 | cn.tedu
45 | sp01-commons
46 | 0.0.1-SNAPSHOT
47 |
48 |
49 | org.springframework.retry
50 | spring-retry
51 |
52 |
53 | org.springframework.cloud
54 | spring-cloud-starter-config
55 |
56 |
57 | org.springframework.boot
58 | spring-boot-starter-amqp
59 |
60 |
61 | org.springframework.cloud
62 | spring-cloud-bus
63 |
64 |
65 | org.springframework.cloud
66 | spring-cloud-stream-binder-rabbit
67 |
68 |
69 | org.springframework.amqp
70 | spring-rabbit-test
71 | test
72 |
73 |
74 | org.springframework.cloud
75 | spring-cloud-starter-sleuth
76 |
77 |
78 | org.springframework.cloud
79 | spring-cloud-starter-zipkin
80 |
81 |
82 |
83 |
84 |
85 |
86 | org.springframework.cloud
87 | spring-cloud-dependencies
88 | ${spring-cloud.version}
89 | pom
90 | import
91 |
92 |
93 |
94 |
95 |
96 |
97 |
98 | org.springframework.boot
99 | spring-boot-maven-plugin
100 |
101 |
102 |
103 |
104 |
--------------------------------------------------------------------------------
/sp04-orderservice/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 | cn.tedu
12 | sp04-orderservice
13 | 0.0.1-SNAPSHOT
14 | sp04-orderservice
15 | Demo project for Spring Boot
16 |
17 |
18 | 1.8
19 |
20 |
21 |
22 |
23 | org.springframework.boot
24 | spring-boot-starter-web
25 |
26 |
27 |
28 | org.springframework.boot
29 | spring-boot-starter-test
30 | test
31 |
32 |
33 | org.junit.vintage
34 | junit-vintage-engine
35 |
36 |
37 |
38 |
39 | cn.tedu
40 | sp01-commons
41 | 0.0.1-SNAPSHOT
42 |
43 |
44 | org.springframework.cloud
45 |
46 | spring-cloud-starter-netflix-eureka-client
47 |
48 |
49 |
50 | org.springframework.boot
51 | spring-boot-starter-actuator
52 |
53 |
54 | org.springframework.cloud
55 |
56 | spring-cloud-starter-netflix-hystrix
57 |
58 |
59 |
60 | org.springframework.cloud
61 | spring-cloud-starter-openfeign
62 |
63 |
64 | org.springframework.cloud
65 | spring-cloud-starter-config
66 |
67 |
68 | org.springframework.boot
69 | spring-boot-starter-amqp
70 |
71 |
72 | org.springframework.cloud
73 | spring-cloud-bus
74 |
75 |
76 | org.springframework.cloud
77 | spring-cloud-stream-binder-rabbit
78 |
79 |
80 | org.springframework.amqp
81 | spring-rabbit-test
82 | test
83 |
84 |
85 | org.springframework.cloud
86 | spring-cloud-starter-sleuth
87 |
88 |
89 | org.springframework.cloud
90 | spring-cloud-starter-zipkin
91 |
92 |
93 |
94 |
95 |
96 |
97 | org.springframework.boot
98 | spring-boot-maven-plugin
99 |
100 |
101 |
102 |
103 |
104 |
105 |
106 | org.springframework.cloud
107 | spring-cloud-dependencies
108 | Hoxton.RELEASE
109 | pom
110 | import
111 |
112 |
113 |
114 |
--------------------------------------------------------------------------------
/sp11-zuul/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp05-eureka/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp06-ribbon/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp07-hystrix/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp09-feign/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp10-turbine/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp12-config/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp02-itemservice/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp03-userservice/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp04-orderservice/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp08-hystrix-dashboard/.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 | import java.net.*;
17 | import java.io.*;
18 | import java.nio.channels.*;
19 | import java.util.Properties;
20 |
21 | public class MavenWrapperDownloader {
22 |
23 | private static final String WRAPPER_VERSION = "0.5.5";
24 | /**
25 | * Default URL to download the maven-wrapper.jar from, if no 'downloadUrl' is provided.
26 | */
27 | private static final String DEFAULT_DOWNLOAD_URL = "https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/"
28 | + WRAPPER_VERSION + "/maven-wrapper-" + WRAPPER_VERSION + ".jar";
29 |
30 | /**
31 | * Path to the maven-wrapper.properties file, which might contain a downloadUrl property to
32 | * use instead of the default one.
33 | */
34 | private static final String MAVEN_WRAPPER_PROPERTIES_PATH =
35 | ".mvn/wrapper/maven-wrapper.properties";
36 |
37 | /**
38 | * Path where the maven-wrapper.jar will be saved to.
39 | */
40 | private static final String MAVEN_WRAPPER_JAR_PATH =
41 | ".mvn/wrapper/maven-wrapper.jar";
42 |
43 | /**
44 | * Name of the property which should be used to override the default download url for the wrapper.
45 | */
46 | private static final String PROPERTY_NAME_WRAPPER_URL = "wrapperUrl";
47 |
48 | public static void main(String args[]) {
49 | System.out.println("- Downloader started");
50 | File baseDirectory = new File(args[0]);
51 | System.out.println("- Using base directory: " + baseDirectory.getAbsolutePath());
52 |
53 | // If the maven-wrapper.properties exists, read it and check if it contains a custom
54 | // wrapperUrl parameter.
55 | File mavenWrapperPropertyFile = new File(baseDirectory, MAVEN_WRAPPER_PROPERTIES_PATH);
56 | String url = DEFAULT_DOWNLOAD_URL;
57 | if(mavenWrapperPropertyFile.exists()) {
58 | FileInputStream mavenWrapperPropertyFileInputStream = null;
59 | try {
60 | mavenWrapperPropertyFileInputStream = new FileInputStream(mavenWrapperPropertyFile);
61 | Properties mavenWrapperProperties = new Properties();
62 | mavenWrapperProperties.load(mavenWrapperPropertyFileInputStream);
63 | url = mavenWrapperProperties.getProperty(PROPERTY_NAME_WRAPPER_URL, url);
64 | } catch (IOException e) {
65 | System.out.println("- ERROR loading '" + MAVEN_WRAPPER_PROPERTIES_PATH + "'");
66 | } finally {
67 | try {
68 | if(mavenWrapperPropertyFileInputStream != null) {
69 | mavenWrapperPropertyFileInputStream.close();
70 | }
71 | } catch (IOException e) {
72 | // Ignore ...
73 | }
74 | }
75 | }
76 | System.out.println("- Downloading from: " + url);
77 |
78 | File outputFile = new File(baseDirectory.getAbsolutePath(), MAVEN_WRAPPER_JAR_PATH);
79 | if(!outputFile.getParentFile().exists()) {
80 | if(!outputFile.getParentFile().mkdirs()) {
81 | System.out.println(
82 | "- ERROR creating output directory '" + outputFile.getParentFile().getAbsolutePath() + "'");
83 | }
84 | }
85 | System.out.println("- Downloading to: " + outputFile.getAbsolutePath());
86 | try {
87 | downloadFileFromURL(url, outputFile);
88 | System.out.println("Done");
89 | System.exit(0);
90 | } catch (Throwable e) {
91 | System.out.println("- Error downloading");
92 | e.printStackTrace();
93 | System.exit(1);
94 | }
95 | }
96 |
97 | private static void downloadFileFromURL(String urlString, File destination) throws Exception {
98 | if (System.getenv("MVNW_USERNAME") != null && System.getenv("MVNW_PASSWORD") != null) {
99 | String username = System.getenv("MVNW_USERNAME");
100 | char[] password = System.getenv("MVNW_PASSWORD").toCharArray();
101 | Authenticator.setDefault(new Authenticator() {
102 | @Override
103 | protected PasswordAuthentication getPasswordAuthentication() {
104 | return new PasswordAuthentication(username, password);
105 | }
106 | });
107 | }
108 | URL website = new URL(urlString);
109 | ReadableByteChannel rbc;
110 | rbc = Channels.newChannel(website.openStream());
111 | FileOutputStream fos = new FileOutputStream(destination);
112 | fos.getChannel().transferFrom(rbc, 0, Long.MAX_VALUE);
113 | fos.close();
114 | rbc.close();
115 | }
116 |
117 | }
118 |
--------------------------------------------------------------------------------
/sp09-feign/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 https://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 by 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.5.5/maven-wrapper-0.5.5.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/sp11-zuul/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 https://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 by 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.5.5/maven-wrapper-0.5.5.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/sp05-eureka/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 https://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 by 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.5.5/maven-wrapper-0.5.5.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/sp06-ribbon/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 https://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 by 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.5.5/maven-wrapper-0.5.5.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------
/sp07-hystrix/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 https://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 by 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.5.5/maven-wrapper-0.5.5.jar"
124 |
125 | FOR /F "tokens=1,2 delims==" %%A IN ("%MAVEN_PROJECTBASEDIR%\.mvn\wrapper\maven-wrapper.properties") DO (
126 | IF "%%A"=="wrapperUrl" SET DOWNLOAD_URL=%%B
127 | )
128 |
129 | @REM Extension to allow automatically downloading the maven-wrapper.jar from Maven-central
130 | @REM This allows using the maven wrapper in projects that prohibit checking in binary data.
131 | if exist %WRAPPER_JAR% (
132 | if "%MVNW_VERBOSE%" == "true" (
133 | echo Found %WRAPPER_JAR%
134 | )
135 | ) else (
136 | if not "%MVNW_REPOURL%" == "" (
137 | SET DOWNLOAD_URL="%MVNW_REPOURL%/io/takari/maven-wrapper/0.5.5/maven-wrapper-0.5.5.jar"
138 | )
139 | if "%MVNW_VERBOSE%" == "true" (
140 | echo Couldn't find %WRAPPER_JAR%, downloading it ...
141 | echo Downloading from: %DOWNLOAD_URL%
142 | )
143 |
144 | powershell -Command "&{"^
145 | "$webclient = new-object System.Net.WebClient;"^
146 | "if (-not ([string]::IsNullOrEmpty('%MVNW_USERNAME%') -and [string]::IsNullOrEmpty('%MVNW_PASSWORD%'))) {"^
147 | "$webclient.Credentials = new-object System.Net.NetworkCredential('%MVNW_USERNAME%', '%MVNW_PASSWORD%');"^
148 | "}"^
149 | "[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12; $webclient.DownloadFile('%DOWNLOAD_URL%', '%WRAPPER_JAR%')"^
150 | "}"
151 | if "%MVNW_VERBOSE%" == "true" (
152 | echo Finished downloading %WRAPPER_JAR%
153 | )
154 | )
155 | @REM End of extension
156 |
157 | @REM Provide a "standardized" way to retrieve the CLI args that will
158 | @REM work with both Windows and non-Windows executions.
159 | set MAVEN_CMD_LINE_ARGS=%*
160 |
161 | %MAVEN_JAVA_EXE% %JVM_CONFIG_MAVEN_PROPS% %MAVEN_OPTS% %MAVEN_DEBUG_OPTS% -classpath %WRAPPER_JAR% "-Dmaven.multiModuleProjectDirectory=%MAVEN_PROJECTBASEDIR%" %WRAPPER_LAUNCHER% %MAVEN_CONFIG% %*
162 | if ERRORLEVEL 1 goto error
163 | goto end
164 |
165 | :error
166 | set ERROR_CODE=1
167 |
168 | :end
169 | @endlocal & set ERROR_CODE=%ERROR_CODE%
170 |
171 | if not "%MAVEN_SKIP_RC%" == "" goto skipRcPost
172 | @REM check for post script, once with legacy .bat ending and once with .cmd ending
173 | if exist "%HOME%\mavenrc_post.bat" call "%HOME%\mavenrc_post.bat"
174 | if exist "%HOME%\mavenrc_post.cmd" call "%HOME%\mavenrc_post.cmd"
175 | :skipRcPost
176 |
177 | @REM pause the script if MAVEN_BATCH_PAUSE is set to 'on'
178 | if "%MAVEN_BATCH_PAUSE%" == "on" pause
179 |
180 | if "%MAVEN_TERMINATE_CMD%" == "on" exit %ERROR_CODE%
181 |
182 | exit /B %ERROR_CODE%
183 |
--------------------------------------------------------------------------------