From 7f23fa2be25444dd64ecb47c00d58a374eaec9c0 Mon Sep 17 00:00:00 2001 From: YunaiV <> Date: Mon, 18 May 2020 20:38:56 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96=20resilience4j?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lab-59/lab-59-user-service/pom.xml | 40 +++++++++++++++++++ .../userservice/UserServiceApplication.java | 40 +++++++++++++++++++ lab-59/pom.xml | 19 +++++++++ pom.xml | 1 + 4 files changed, 100 insertions(+) create mode 100644 lab-59/lab-59-user-service/pom.xml create mode 100644 lab-59/lab-59-user-service/src/main/java/cn/iocoder/springboot/lab59/userservice/UserServiceApplication.java create mode 100644 lab-59/pom.xml diff --git a/lab-59/lab-59-user-service/pom.xml b/lab-59/lab-59-user-service/pom.xml new file mode 100644 index 00000000..eb372295 --- /dev/null +++ b/lab-59/lab-59-user-service/pom.xml @@ -0,0 +1,40 @@ + + + + lab-59 + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + lab-59-user-service + + + 1.8 + 1.8 + 2.2.4.RELEASE + + + + + + org.springframework.boot + spring-boot-starter-parent + ${spring.boot.version} + pom + import + + + + + + + + org.springframework.boot + spring-boot-starter-web + + + + diff --git a/lab-59/lab-59-user-service/src/main/java/cn/iocoder/springboot/lab59/userservice/UserServiceApplication.java b/lab-59/lab-59-user-service/src/main/java/cn/iocoder/springboot/lab59/userservice/UserServiceApplication.java new file mode 100644 index 00000000..fdbd7a1a --- /dev/null +++ b/lab-59/lab-59-user-service/src/main/java/cn/iocoder/springboot/lab59/userservice/UserServiceApplication.java @@ -0,0 +1,40 @@ +package cn.iocoder.springboot.lab59.userservice; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; + +import java.util.List; +import java.util.stream.Collectors; + +@SpringBootApplication +public class UserServiceApplication { + + @RestController + @RequestMapping("/user") + public class UserController { + + @GetMapping("/get") + public String get(@RequestParam("id") Integer id) { + return "User:" + id; + } + + @GetMapping("/batch_get") + public List batchGet(@RequestParam("ids") List ids) { + return ids.stream().map(id -> "User:" + id).collect(Collectors.toList()); + } + + } + + public static void main(String[] args) { + // 设置端口 + System.setProperty("server.port", "18080"); + + // 应用启动 + SpringApplication.run(UserServiceApplication.class, args); + } + +} diff --git a/lab-59/pom.xml b/lab-59/pom.xml new file mode 100644 index 00000000..e9d36038 --- /dev/null +++ b/lab-59/pom.xml @@ -0,0 +1,19 @@ + + + + labs-parent + cn.iocoder.springboot.labs + 1.0-SNAPSHOT + + 4.0.0 + + lab-59 + pom + + + lab-59-user-service + + + diff --git a/pom.xml b/pom.xml index db6acb91..42170d7f 100644 --- a/pom.xml +++ b/pom.xml @@ -95,6 +95,7 @@ + lab-59