初始化 resilience4j

This commit is contained in:
YunaiV
2020-05-18 20:38:56 +08:00
parent e7efd5728f
commit 7f23fa2be2
4 changed files with 100 additions and 0 deletions

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>lab-59</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lab-59-user-service</artifactId>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>${spring.boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- 引入 SpringMVC 相关依赖,并实现对其的自动配置 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
</project>

View File

@@ -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<String> batchGet(@RequestParam("ids") List<Integer> 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);
}
}

19
lab-59/pom.xml Normal file
View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>labs-parent</artifactId>
<groupId>cn.iocoder.springboot.labs</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>lab-59</artifactId>
<packaging>pom</packaging>
<modules>
<module>lab-59-user-service</module>
</modules>
</project>

View File

@@ -95,6 +95,7 @@
<!-- <module>labx-22</module>-->
<!-- <module>labx-23</module>-->
<module>lab-59</module>
</modules>
</project>