File tree 4 files changed +100
-0
lines changed
src/main/java/cn/iocoder/springboot/lab59/userservice
4 files changed +100
-0
lines changed Original file line number Diff line number Diff line change
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 number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change
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 >
Original file line number Diff line number Diff line change 95
95
<!-- <module>labx-22</module>-->
96
96
<!-- <module>labx-23</module>-->
97
97
98
+ <module >lab-59</module >
98
99
</modules >
99
100
100
101
</project >
You can’t perform that action at this time.
0 commit comments