Repository navigation
Expand file tree
/
Copy pathpom.xml
More file actions
77 lines (68 loc) · 3.02 KB
/
Copy pathpom.xml
File metadata and controls
77 lines (68 loc) · 3.02 KB
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>4.1.1</version>
<relativePath/>
</parent>
<groupId>com.xncoding</groupId>
<artifactId>springboot4-openapi</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>springboot4-openapi</name>
<description>Spring Boot 4 教程:使用 OpenAPI 3.1 接口文档</description>
<properties>
<java.version>21</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<!-- Boot 官方 BOM 不管理 springdoc,版本只能自己给(取 springdoc 3.1.1,
其父 POM 基于 spring-boot-starter-parent 4.1.0 构建,与 Boot 4.1 匹配) -->
<springdoc-openapi.version>3.1.1</springdoc-openapi.version>
</properties>
<dependencies>
<!-- Web MVC:订单服务的 HTTP 接口面 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc</artifactId>
</dependency>
<!-- 校验:DTO 上的 @NotBlank/@Size 等注解,同时会被 springdoc 带进 schema 约束 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<!-- 安全:/api/admin 走 HTTP Basic,401/403 声明进文档 -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
<!-- 本篇主角:springdoc-openapi webmvc + swagger-ui。
不受 Boot BOM 管理,必须显式写版本号 -->
<dependency>
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
<version>${springdoc-openapi.version}</version>
</dependency>
<!-- 测试:security-test 提供 httpBasic() 请求后处理器,webmvc-test 提供 @AutoConfigureMockMvc -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webmvc-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>