Skip to content

Commit 7f23fa2

Browse files
author
YunaiV
committed
初始化 resilience4j
1 parent e7efd57 commit 7f23fa2

File tree

4 files changed

+100
-0
lines changed

4 files changed

+100
-0
lines changed

lab-59/lab-59-user-service/pom.xml

+40
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>lab-59</artifactId>
7+
<groupId>cn.iocoder.springboot.labs</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>lab-59-user-service</artifactId>
13+
14+
<properties>
15+
<maven.compiler.target>1.8</maven.compiler.target>
16+
<maven.compiler.source>1.8</maven.compiler.source>
17+
<spring.boot.version>2.2.4.RELEASE</spring.boot.version>
18+
</properties>
19+
20+
<dependencyManagement>
21+
<dependencies>
22+
<dependency>
23+
<groupId>org.springframework.boot</groupId>
24+
<artifactId>spring-boot-starter-parent</artifactId>
25+
<version>${spring.boot.version}</version>
26+
<type>pom</type>
27+
<scope>import</scope>
28+
</dependency>
29+
</dependencies>
30+
</dependencyManagement>
31+
32+
<dependencies>
33+
<!-- 引入 SpringMVC 相关依赖,并实现对其的自动配置 -->
34+
<dependency>
35+
<groupId>org.springframework.boot</groupId>
36+
<artifactId>spring-boot-starter-web</artifactId>
37+
</dependency>
38+
</dependencies>
39+
40+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
package cn.iocoder.springboot.lab59.userservice;
2+
3+
import org.springframework.boot.SpringApplication;
4+
import org.springframework.boot.autoconfigure.SpringBootApplication;
5+
import org.springframework.web.bind.annotation.GetMapping;
6+
import org.springframework.web.bind.annotation.RequestMapping;
7+
import org.springframework.web.bind.annotation.RequestParam;
8+
import org.springframework.web.bind.annotation.RestController;
9+
10+
import java.util.List;
11+
import java.util.stream.Collectors;
12+
13+
@SpringBootApplication
14+
public class UserServiceApplication {
15+
16+
@RestController
17+
@RequestMapping("/user")
18+
public class UserController {
19+
20+
@GetMapping("/get")
21+
public String get(@RequestParam("id") Integer id) {
22+
return "User:" + id;
23+
}
24+
25+
@GetMapping("/batch_get")
26+
public List<String> batchGet(@RequestParam("ids") List<Integer> ids) {
27+
return ids.stream().map(id -> "User:" + id).collect(Collectors.toList());
28+
}
29+
30+
}
31+
32+
public static void main(String[] args) {
33+
// 设置端口
34+
System.setProperty("server.port", "18080");
35+
36+
// 应用启动
37+
SpringApplication.run(UserServiceApplication.class, args);
38+
}
39+
40+
}

lab-59/pom.xml

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
5+
<parent>
6+
<artifactId>labs-parent</artifactId>
7+
<groupId>cn.iocoder.springboot.labs</groupId>
8+
<version>1.0-SNAPSHOT</version>
9+
</parent>
10+
<modelVersion>4.0.0</modelVersion>
11+
12+
<artifactId>lab-59</artifactId>
13+
<packaging>pom</packaging>
14+
15+
<modules>
16+
<module>lab-59-user-service</module>
17+
</modules>
18+
19+
</project>

pom.xml

+1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@
9595
<!-- <module>labx-22</module>-->
9696
<!-- <module>labx-23</module>-->
9797

98+
<module>lab-59</module>
9899
</modules>
99100

100101
</project>

0 commit comments

Comments
 (0)