Commit ca90fcb8fa35e6b04501bce8acbe61d087ed1a3b
1 parent
0e338839
接入 swagger + knife4j 组件,实现 API 接口文档
Showing
7 changed files
with
512 additions
and
267 deletions
http-client.env.json
0 → 100644
pom.xml
| 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 | - <modelVersion>4.0.0</modelVersion> | |
| 6 | - | |
| 7 | - <groupId>cn.iocoder</groupId> | |
| 8 | - <artifactId>dashboard</artifactId> | |
| 9 | - <version>1.0.0</version> | |
| 10 | - | |
| 11 | - <name>ruoyi</name> | |
| 12 | - <url>http://www.ruoyi.vip</url> | |
| 13 | - <description>若依管理系统</description> | |
| 14 | - | |
| 15 | - <properties> | |
| 16 | - <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
| 17 | - <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
| 18 | - <resource.delimiter>@</resource.delimiter> | |
| 19 | - <java.version>1.8</java.version> | |
| 20 | - <maven.compiler.source>${java.version}</maven.compiler.source> | |
| 21 | - <maven.compiler.target>${java.version}</maven.compiler.target> | |
| 22 | - <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> | |
| 23 | - <!-- 统一依赖管理 --> | |
| 24 | - <spring.boot.version>2.4.1</spring.boot.version> | |
| 25 | - | |
| 26 | -<!-- <ruoyi.version>3.3.0</ruoyi.version>--> | |
| 27 | -<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>--> | |
| 28 | -<!-- <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>--> | |
| 29 | -<!-- <druid.version>1.2.2</druid.version>--> | |
| 30 | -<!-- <bitwalker.version>1.21</bitwalker.version>--> | |
| 31 | -<!-- <swagger.version>2.9.2</swagger.version>--> | |
| 32 | -<!-- <kaptcha.version>2.3.2</kaptcha.version>--> | |
| 33 | -<!-- <pagehelper.boot.version>1.3.0</pagehelper.boot.version>--> | |
| 34 | -<!-- <fastjson.version>1.2.74</fastjson.version>--> | |
| 35 | -<!-- <oshi.version>5.3.6</oshi.version>--> | |
| 36 | -<!-- <jna.version>5.6.0</jna.version>--> | |
| 37 | -<!-- <commons.io.version>2.5</commons.io.version>--> | |
| 38 | -<!-- <commons.fileupload.version>1.3.3</commons.fileupload.version>--> | |
| 39 | -<!-- <poi.version>4.1.2</poi.version>--> | |
| 40 | -<!-- <velocity.version>1.7</velocity.version>--> | |
| 41 | -<!-- <jwt.version>0.9.1</jwt.version>--> | |
| 42 | - | |
| 43 | - <!-- Web 相关 --> | |
| 44 | - | |
| 45 | - <!-- DB 相关 --> | |
| 46 | - <mysql-connector-java.version>5.1.46</mysql-connector-java.version> | |
| 47 | - <druid.version>1.2.4</druid.version> | |
| 48 | - <mybatis-plus.version>3.4.1</mybatis-plus.version> | |
| 49 | - <!-- 工具类相关 --> | |
| 50 | - <org.projectlombok.version>1.16.14</org.projectlombok.version> | |
| 51 | - <org.mapstruct.version>1.3.0.Final</org.mapstruct.version> | |
| 52 | - </properties> | |
| 53 | - | |
| 54 | - <!-- 依赖声明 --> | |
| 55 | - <dependencyManagement> | |
| 56 | - <dependencies> | |
| 57 | - | |
| 58 | -<!-- <!–阿里数据库连接池 –>--> | |
| 59 | -<!-- <dependency>--> | |
| 60 | -<!-- <groupId>com.alibaba</groupId>--> | |
| 61 | -<!-- <artifactId>druid-spring-boot-starter</artifactId>--> | |
| 62 | -<!-- <version>${druid.version}</version>--> | |
| 63 | -<!-- </dependency>--> | |
| 64 | - | |
| 65 | -<!-- <!– 解析客户端操作系统、浏览器等 –>--> | |
| 66 | -<!-- <dependency>--> | |
| 67 | -<!-- <groupId>eu.bitwalker</groupId>--> | |
| 68 | -<!-- <artifactId>UserAgentUtils</artifactId>--> | |
| 69 | -<!-- <version>${bitwalker.version}</version>--> | |
| 70 | -<!-- </dependency>--> | |
| 71 | - | |
| 72 | -<!-- <!– pagehelper 分页插件 –>--> | |
| 73 | -<!-- <dependency>--> | |
| 74 | -<!-- <groupId>com.github.pagehelper</groupId>--> | |
| 75 | -<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> | |
| 76 | -<!-- <version>${pagehelper.boot.version}</version>--> | |
| 77 | -<!-- </dependency>--> | |
| 78 | - | |
| 79 | -<!-- <!– 获取系统信息 –>--> | |
| 80 | -<!-- <dependency>--> | |
| 81 | -<!-- <groupId>com.github.oshi</groupId>--> | |
| 82 | -<!-- <artifactId>oshi-core</artifactId>--> | |
| 83 | -<!-- <version>${oshi.version}</version>--> | |
| 84 | -<!-- </dependency>--> | |
| 85 | - | |
| 86 | -<!-- <dependency>--> | |
| 87 | -<!-- <groupId>net.java.dev.jna</groupId>--> | |
| 88 | -<!-- <artifactId>jna</artifactId>--> | |
| 89 | -<!-- <version>${jna.version}</version>--> | |
| 90 | -<!-- </dependency>--> | |
| 91 | - | |
| 92 | -<!-- <dependency>--> | |
| 93 | -<!-- <groupId>net.java.dev.jna</groupId>--> | |
| 94 | -<!-- <artifactId>jna-platform</artifactId>--> | |
| 95 | -<!-- <version>${jna.version}</version>--> | |
| 96 | -<!-- </dependency>--> | |
| 97 | - | |
| 98 | -<!-- <!– swagger2–>--> | |
| 99 | -<!-- <dependency>--> | |
| 100 | -<!-- <groupId>io.springfox</groupId>--> | |
| 101 | -<!-- <artifactId>springfox-swagger2</artifactId>--> | |
| 102 | -<!-- <version>${swagger.version}</version>--> | |
| 103 | -<!-- <exclusions>--> | |
| 104 | -<!-- <exclusion>--> | |
| 105 | -<!-- <groupId>io.swagger</groupId>--> | |
| 106 | -<!-- <artifactId>swagger-annotations</artifactId>--> | |
| 107 | -<!-- </exclusion>--> | |
| 108 | -<!-- <exclusion>--> | |
| 109 | -<!-- <groupId>io.swagger</groupId>--> | |
| 110 | -<!-- <artifactId>swagger-models</artifactId>--> | |
| 111 | -<!-- </exclusion>--> | |
| 112 | -<!-- </exclusions>--> | |
| 113 | -<!-- </dependency>--> | |
| 114 | - | |
| 115 | -<!-- <!– swagger2-UI–>--> | |
| 116 | -<!-- <dependency>--> | |
| 117 | -<!-- <groupId>io.springfox</groupId>--> | |
| 118 | -<!-- <artifactId>springfox-swagger-ui</artifactId>--> | |
| 119 | -<!-- <version>${swagger.version}</version>--> | |
| 120 | -<!-- </dependency>--> | |
| 121 | - | |
| 122 | -<!-- <!–io常用工具类 –>--> | |
| 123 | -<!-- <dependency>--> | |
| 124 | -<!-- <groupId>commons-io</groupId>--> | |
| 125 | -<!-- <artifactId>commons-io</artifactId>--> | |
| 126 | -<!-- <version>${commons.io.version}</version>--> | |
| 127 | -<!-- </dependency>--> | |
| 128 | - | |
| 129 | -<!-- <!–文件上传工具类 –>--> | |
| 130 | -<!-- <dependency>--> | |
| 131 | -<!-- <groupId>commons-fileupload</groupId>--> | |
| 132 | -<!-- <artifactId>commons-fileupload</artifactId>--> | |
| 133 | -<!-- <version>${commons.fileupload.version}</version>--> | |
| 134 | -<!-- </dependency>--> | |
| 135 | - | |
| 136 | -<!-- <!– excel工具 –>--> | |
| 137 | -<!-- <dependency>--> | |
| 138 | -<!-- <groupId>org.apache.poi</groupId>--> | |
| 139 | -<!-- <artifactId>poi-ooxml</artifactId>--> | |
| 140 | -<!-- <version>${poi.version}</version>--> | |
| 141 | -<!-- </dependency>--> | |
| 142 | - | |
| 143 | -<!-- <!–velocity代码生成使用模板 –>--> | |
| 144 | -<!-- <dependency>--> | |
| 145 | -<!-- <groupId>org.apache.velocity</groupId>--> | |
| 146 | -<!-- <artifactId>velocity</artifactId>--> | |
| 147 | -<!-- <version>${velocity.version}</version>--> | |
| 148 | -<!-- </dependency>--> | |
| 149 | - | |
| 150 | -<!-- <!– 阿里JSON解析器 –>--> | |
| 151 | -<!-- <dependency>--> | |
| 152 | -<!-- <groupId>com.alibaba</groupId>--> | |
| 153 | -<!-- <artifactId>fastjson</artifactId>--> | |
| 154 | -<!-- <version>${fastjson.version}</version>--> | |
| 155 | -<!-- </dependency>--> | |
| 156 | - | |
| 157 | -<!-- <!–Token生成与解析–>--> | |
| 158 | -<!-- <dependency>--> | |
| 159 | -<!-- <groupId>io.jsonwebtoken</groupId>--> | |
| 160 | -<!-- <artifactId>jjwt</artifactId>--> | |
| 161 | -<!-- <version>${jwt.version}</version>--> | |
| 162 | -<!-- </dependency>--> | |
| 163 | - | |
| 164 | -<!-- <!–验证码 –>--> | |
| 165 | -<!-- <dependency>--> | |
| 166 | -<!-- <groupId>com.github.penggle</groupId>--> | |
| 167 | -<!-- <artifactId>kaptcha</artifactId>--> | |
| 168 | -<!-- <version>${kaptcha.version}</version>--> | |
| 169 | -<!-- </dependency>--> | |
| 170 | - | |
| 171 | - <!-- 统一依赖管理 --> | |
| 172 | - <dependency> | |
| 173 | - <groupId>org.springframework.boot</groupId> | |
| 174 | - <artifactId>spring-boot-dependencies</artifactId> | |
| 175 | - <version>${spring.boot.version}</version> | |
| 176 | - <type>pom</type> | |
| 177 | - <scope>import</scope> | |
| 178 | - </dependency> | |
| 179 | - </dependencies> | |
| 180 | - </dependencyManagement> | |
| 181 | - | |
| 182 | -<!-- <modules>--> | |
| 183 | -<!-- <module>ruoyi-admin</module>--> | |
| 184 | -<!-- <module>ruoyi-framework</module>--> | |
| 185 | -<!-- <module>ruoyi-system</module>--> | |
| 186 | -<!-- <module>ruoyi-quartz</module>--> | |
| 187 | -<!-- <module>ruoyi-generator</module>--> | |
| 188 | -<!-- <module>ruoyi-common</module>--> | |
| 189 | -<!-- </modules>--> | |
| 190 | - <packaging>jar</packaging> | |
| 191 | - | |
| 192 | - <dependencies> | |
| 193 | - | |
| 194 | - <!-- Web 相关 --> | |
| 195 | - <dependency> | |
| 196 | - <groupId>org.springframework.boot</groupId> | |
| 197 | - <artifactId>spring-boot-starter-web</artifactId> | |
| 198 | - </dependency> | |
| 199 | - | |
| 200 | - <!-- DB 相关 --> | |
| 201 | - <dependency> | |
| 202 | - <groupId>mysql</groupId> | |
| 203 | - <artifactId>mysql-connector-java</artifactId> | |
| 204 | - <version>${mysql-connector-java.version}</version> | |
| 205 | - </dependency> | |
| 206 | - | |
| 207 | - <dependency> | |
| 208 | - <groupId>com.alibaba</groupId> | |
| 209 | - <artifactId>druid-spring-boot-starter</artifactId> | |
| 210 | - <version>${druid.version}</version> | |
| 211 | - </dependency> | |
| 212 | - | |
| 213 | - <dependency> | |
| 214 | - <groupId>com.baomidou</groupId> | |
| 215 | - <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 216 | - <version>${mybatis-plus.version}</version> | |
| 217 | - </dependency> | |
| 218 | - | |
| 219 | - <!-- 工具类相关 --> | |
| 220 | - <dependency> | |
| 221 | - <groupId>org.projectlombok</groupId> | |
| 222 | - <artifactId>lombok</artifactId> | |
| 223 | - <version>${org.projectlombok.version}</version> | |
| 224 | - </dependency> | |
| 225 | - </dependencies> | |
| 226 | - | |
| 227 | - | |
| 228 | - <build> | |
| 229 | - <pluginManagement> | |
| 230 | - <plugins> | |
| 231 | - <!-- 提供给 mapstruct 使用 --> | |
| 232 | - <plugin> | |
| 233 | - <groupId>org.apache.maven.plugins</groupId> | |
| 234 | - <artifactId>maven-compiler-plugin</artifactId> | |
| 235 | - <version>${maven-compiler-plugin.version}</version> | |
| 236 | - <configuration> | |
| 237 | - <source>${java.version}</source> <!-- or higher, depending on your project --> | |
| 238 | - <target>${java.version}</target> <!-- or higher, depending on your project --> | |
| 239 | - <annotationProcessorPaths> | |
| 240 | - <path> | |
| 241 | - <groupId>org.mapstruct</groupId> | |
| 242 | - <artifactId>mapstruct-processor</artifactId> | |
| 243 | - <version>${org.mapstruct.version}</version> | |
| 244 | - </path> | |
| 245 | - <path> | |
| 246 | - <groupId>org.projectlombok</groupId> | |
| 247 | - <artifactId>lombok</artifactId> | |
| 248 | - <version>${org.projectlombok.version}</version> | |
| 249 | - </path> | |
| 250 | - </annotationProcessorPaths> | |
| 251 | - </configuration> | |
| 252 | - </plugin> | |
| 253 | - | |
| 254 | - <!-- 打包 --> | |
| 255 | - <plugin> | |
| 256 | - <groupId>org.springframework.boot</groupId> | |
| 257 | - <artifactId>spring-boot-maven-plugin</artifactId> | |
| 258 | - <configuration> | |
| 259 | - <fork>true</fork> | |
| 260 | - </configuration> | |
| 261 | - </plugin> | |
| 262 | - </plugins> | |
| 263 | - </pluginManagement> | |
| 264 | - </build> | |
| 265 | - | |
| 266 | -</project> | |
| 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 | + <modelVersion>4.0.0</modelVersion> | |
| 6 | + | |
| 7 | + <groupId>cn.iocoder</groupId> | |
| 8 | + <artifactId>dashboard</artifactId> | |
| 9 | + <version>1.0.0</version> | |
| 10 | + | |
| 11 | + <name>ruoyi</name> | |
| 12 | + <url>http://www.ruoyi.vip</url> | |
| 13 | + <description>若依管理系统</description> | |
| 14 | + | |
| 15 | + <properties> | |
| 16 | + <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> | |
| 17 | + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | |
| 18 | + <resource.delimiter>@</resource.delimiter> | |
| 19 | + <java.version>1.8</java.version> | |
| 20 | + <maven.compiler.source>${java.version}</maven.compiler.source> | |
| 21 | + <maven.compiler.target>${java.version}</maven.compiler.target> | |
| 22 | + <maven-compiler-plugin.version>3.8.0</maven-compiler-plugin.version> | |
| 23 | + <!-- 统一依赖管理 --> | |
| 24 | + <spring.boot.version>2.4.1</spring.boot.version> | |
| 25 | + | |
| 26 | +<!-- <ruoyi.version>3.3.0</ruoyi.version>--> | |
| 27 | +<!-- <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>--> | |
| 28 | +<!-- <maven-jar-plugin.version>3.1.1</maven-jar-plugin.version>--> | |
| 29 | +<!-- <druid.version>1.2.2</druid.version>--> | |
| 30 | +<!-- <bitwalker.version>1.21</bitwalker.version>--> | |
| 31 | +<!-- <swagger.version>2.9.2</swagger.version>--> | |
| 32 | +<!-- <kaptcha.version>2.3.2</kaptcha.version>--> | |
| 33 | +<!-- <pagehelper.boot.version>1.3.0</pagehelper.boot.version>--> | |
| 34 | +<!-- <fastjson.version>1.2.74</fastjson.version>--> | |
| 35 | +<!-- <oshi.version>5.3.6</oshi.version>--> | |
| 36 | +<!-- <jna.version>5.6.0</jna.version>--> | |
| 37 | +<!-- <commons.io.version>2.5</commons.io.version>--> | |
| 38 | +<!-- <commons.fileupload.version>1.3.3</commons.fileupload.version>--> | |
| 39 | +<!-- <poi.version>4.1.2</poi.version>--> | |
| 40 | +<!-- <velocity.version>1.7</velocity.version>--> | |
| 41 | +<!-- <jwt.version>0.9.1</jwt.version>--> | |
| 42 | + | |
| 43 | + <!-- Web 相关 --> | |
| 44 | + <knife4j.version>3.0.2</knife4j.version> | |
| 45 | + | |
| 46 | + <!-- DB 相关 --> | |
| 47 | + <mysql-connector-java.version>5.1.46</mysql-connector-java.version> | |
| 48 | + <druid.version>1.2.4</druid.version> | |
| 49 | + <mybatis-plus.version>3.4.1</mybatis-plus.version> | |
| 50 | + <redisson.version>3.13.6</redisson.version> | |
| 51 | + <!-- 工具类相关 --> | |
| 52 | + <org.projectlombok.version>1.16.14</org.projectlombok.version> | |
| 53 | + <org.mapstruct.version>1.3.0.Final</org.mapstruct.version> | |
| 54 | + <jjwt.version>0.9.1</jjwt.version> | |
| 55 | + <fastjson.version>1.2.75</fastjson.version> | |
| 56 | + <hutool.version>5.5.6</hutool.version> | |
| 57 | + </properties> | |
| 58 | + | |
| 59 | + <!-- 依赖声明 --> | |
| 60 | + <dependencyManagement> | |
| 61 | + <dependencies> | |
| 62 | + | |
| 63 | +<!-- <!–阿里数据库连接池 –>--> | |
| 64 | +<!-- <dependency>--> | |
| 65 | +<!-- <groupId>com.alibaba</groupId>--> | |
| 66 | +<!-- <artifactId>druid-spring-boot-starter</artifactId>--> | |
| 67 | +<!-- <version>${druid.version}</version>--> | |
| 68 | +<!-- </dependency>--> | |
| 69 | + | |
| 70 | +<!-- <!– 解析客户端操作系统、浏览器等 –>--> | |
| 71 | +<!-- <dependency>--> | |
| 72 | +<!-- <groupId>eu.bitwalker</groupId>--> | |
| 73 | +<!-- <artifactId>UserAgentUtils</artifactId>--> | |
| 74 | +<!-- <version>${bitwalker.version}</version>--> | |
| 75 | +<!-- </dependency>--> | |
| 76 | + | |
| 77 | +<!-- <!– pagehelper 分页插件 –>--> | |
| 78 | +<!-- <dependency>--> | |
| 79 | +<!-- <groupId>com.github.pagehelper</groupId>--> | |
| 80 | +<!-- <artifactId>pagehelper-spring-boot-starter</artifactId>--> | |
| 81 | +<!-- <version>${pagehelper.boot.version}</version>--> | |
| 82 | +<!-- </dependency>--> | |
| 83 | + | |
| 84 | +<!-- <!– 获取系统信息 –>--> | |
| 85 | +<!-- <dependency>--> | |
| 86 | +<!-- <groupId>com.github.oshi</groupId>--> | |
| 87 | +<!-- <artifactId>oshi-core</artifactId>--> | |
| 88 | +<!-- <version>${oshi.version}</version>--> | |
| 89 | +<!-- </dependency>--> | |
| 90 | + | |
| 91 | +<!-- <dependency>--> | |
| 92 | +<!-- <groupId>net.java.dev.jna</groupId>--> | |
| 93 | +<!-- <artifactId>jna</artifactId>--> | |
| 94 | +<!-- <version>${jna.version}</version>--> | |
| 95 | +<!-- </dependency>--> | |
| 96 | + | |
| 97 | +<!-- <dependency>--> | |
| 98 | +<!-- <groupId>net.java.dev.jna</groupId>--> | |
| 99 | +<!-- <artifactId>jna-platform</artifactId>--> | |
| 100 | +<!-- <version>${jna.version}</version>--> | |
| 101 | +<!-- </dependency>--> | |
| 102 | + | |
| 103 | +<!-- <!– swagger2–>--> | |
| 104 | +<!-- <dependency>--> | |
| 105 | +<!-- <groupId>io.springfox</groupId>--> | |
| 106 | +<!-- <artifactId>springfox-swagger2</artifactId>--> | |
| 107 | +<!-- <version>${swagger.version}</version>--> | |
| 108 | +<!-- <exclusions>--> | |
| 109 | +<!-- <exclusion>--> | |
| 110 | +<!-- <groupId>io.swagger</groupId>--> | |
| 111 | +<!-- <artifactId>swagger-annotations</artifactId>--> | |
| 112 | +<!-- </exclusion>--> | |
| 113 | +<!-- <exclusion>--> | |
| 114 | +<!-- <groupId>io.swagger</groupId>--> | |
| 115 | +<!-- <artifactId>swagger-models</artifactId>--> | |
| 116 | +<!-- </exclusion>--> | |
| 117 | +<!-- </exclusions>--> | |
| 118 | +<!-- </dependency>--> | |
| 119 | + | |
| 120 | +<!-- <!– swagger2-UI–>--> | |
| 121 | +<!-- <dependency>--> | |
| 122 | +<!-- <groupId>io.springfox</groupId>--> | |
| 123 | +<!-- <artifactId>springfox-swagger-ui</artifactId>--> | |
| 124 | +<!-- <version>${swagger.version}</version>--> | |
| 125 | +<!-- </dependency>--> | |
| 126 | + | |
| 127 | +<!-- <!–io常用工具类 –>--> | |
| 128 | +<!-- <dependency>--> | |
| 129 | +<!-- <groupId>commons-io</groupId>--> | |
| 130 | +<!-- <artifactId>commons-io</artifactId>--> | |
| 131 | +<!-- <version>${commons.io.version}</version>--> | |
| 132 | +<!-- </dependency>--> | |
| 133 | + | |
| 134 | +<!-- <!–文件上传工具类 –>--> | |
| 135 | +<!-- <dependency>--> | |
| 136 | +<!-- <groupId>commons-fileupload</groupId>--> | |
| 137 | +<!-- <artifactId>commons-fileupload</artifactId>--> | |
| 138 | +<!-- <version>${commons.fileupload.version}</version>--> | |
| 139 | +<!-- </dependency>--> | |
| 140 | + | |
| 141 | +<!-- <!– excel工具 –>--> | |
| 142 | +<!-- <dependency>--> | |
| 143 | +<!-- <groupId>org.apache.poi</groupId>--> | |
| 144 | +<!-- <artifactId>poi-ooxml</artifactId>--> | |
| 145 | +<!-- <version>${poi.version}</version>--> | |
| 146 | +<!-- </dependency>--> | |
| 147 | + | |
| 148 | +<!-- <!–velocity代码生成使用模板 –>--> | |
| 149 | +<!-- <dependency>--> | |
| 150 | +<!-- <groupId>org.apache.velocity</groupId>--> | |
| 151 | +<!-- <artifactId>velocity</artifactId>--> | |
| 152 | +<!-- <version>${velocity.version}</version>--> | |
| 153 | +<!-- </dependency>--> | |
| 154 | + | |
| 155 | +<!-- <!– 阿里JSON解析器 –>--> | |
| 156 | +<!-- <dependency>--> | |
| 157 | +<!-- <groupId>com.alibaba</groupId>--> | |
| 158 | +<!-- <artifactId>fastjson</artifactId>--> | |
| 159 | +<!-- <version>${fastjson.version}</version>--> | |
| 160 | +<!-- </dependency>--> | |
| 161 | + | |
| 162 | +<!-- <!–Token生成与解析–>--> | |
| 163 | +<!-- <dependency>--> | |
| 164 | +<!-- <groupId>io.jsonwebtoken</groupId>--> | |
| 165 | +<!-- <artifactId>jjwt</artifactId>--> | |
| 166 | +<!-- <version>${jwt.version}</version>--> | |
| 167 | +<!-- </dependency>--> | |
| 168 | + | |
| 169 | +<!-- <!–验证码 –>--> | |
| 170 | +<!-- <dependency>--> | |
| 171 | +<!-- <groupId>com.github.penggle</groupId>--> | |
| 172 | +<!-- <artifactId>kaptcha</artifactId>--> | |
| 173 | +<!-- <version>${kaptcha.version}</version>--> | |
| 174 | +<!-- </dependency>--> | |
| 175 | + | |
| 176 | + <!-- 统一依赖管理 --> | |
| 177 | + <dependency> | |
| 178 | + <groupId>org.springframework.boot</groupId> | |
| 179 | + <artifactId>spring-boot-dependencies</artifactId> | |
| 180 | + <version>${spring.boot.version}</version> | |
| 181 | + <type>pom</type> | |
| 182 | + <scope>import</scope> | |
| 183 | + </dependency> | |
| 184 | + </dependencies> | |
| 185 | + </dependencyManagement> | |
| 186 | + | |
| 187 | +<!-- <modules>--> | |
| 188 | +<!-- <module>ruoyi-admin</module>--> | |
| 189 | +<!-- <module>ruoyi-framework</module>--> | |
| 190 | +<!-- <module>ruoyi-system</module>--> | |
| 191 | +<!-- <module>ruoyi-quartz</module>--> | |
| 192 | +<!-- <module>ruoyi-generator</module>--> | |
| 193 | +<!-- <module>ruoyi-common</module>--> | |
| 194 | +<!-- </modules>--> | |
| 195 | + <packaging>jar</packaging> | |
| 196 | + | |
| 197 | + <dependencies> | |
| 198 | + <!-- Spring 核心 --> | |
| 199 | + <dependency> | |
| 200 | + <!-- 用于生成自定义的 Spring @ConfigurationProperties 配置类的说明文件 --> | |
| 201 | + <groupId>org.springframework.boot</groupId> | |
| 202 | + <artifactId>spring-boot-configuration-processor</artifactId> | |
| 203 | + <optional>true</optional> | |
| 204 | + </dependency> | |
| 205 | + | |
| 206 | + <!-- Web 相关 --> | |
| 207 | + <dependency> | |
| 208 | + <groupId>org.springframework.boot</groupId> | |
| 209 | + <artifactId>spring-boot-starter-web</artifactId> | |
| 210 | + </dependency> | |
| 211 | + | |
| 212 | + <dependency> | |
| 213 | + <groupId>org.springframework.boot</groupId> | |
| 214 | + <artifactId>spring-boot-starter-security</artifactId> | |
| 215 | + </dependency> | |
| 216 | + | |
| 217 | + <dependency> | |
| 218 | + <groupId>org.springframework.boot</groupId> | |
| 219 | + <artifactId>spring-boot-starter-validation</artifactId> | |
| 220 | + </dependency> | |
| 221 | + | |
| 222 | + <dependency> | |
| 223 | + <groupId>com.github.xiaoymin</groupId> | |
| 224 | + <artifactId>knife4j-spring-boot-starter</artifactId> | |
| 225 | + <version>${knife4j.version}</version> | |
| 226 | + </dependency> | |
| 227 | + | |
| 228 | + <!-- DB 相关 --> | |
| 229 | + <dependency> | |
| 230 | + <groupId>mysql</groupId> | |
| 231 | + <artifactId>mysql-connector-java</artifactId> | |
| 232 | + <version>${mysql-connector-java.version}</version> | |
| 233 | + </dependency> | |
| 234 | + <dependency> | |
| 235 | + <groupId>com.alibaba</groupId> | |
| 236 | + <artifactId>druid-spring-boot-starter</artifactId> | |
| 237 | + <version>${druid.version}</version> | |
| 238 | + </dependency> | |
| 239 | + <dependency> | |
| 240 | + <groupId>com.baomidou</groupId> | |
| 241 | + <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 242 | + <version>${mybatis-plus.version}</version> | |
| 243 | + </dependency> | |
| 244 | + | |
| 245 | + <dependency> | |
| 246 | + <groupId>org.redisson</groupId> | |
| 247 | + <artifactId>redisson-spring-boot-starter</artifactId> | |
| 248 | + <version>${redisson.version}</version> | |
| 249 | + </dependency> | |
| 250 | + | |
| 251 | + <!-- 工具类相关 --> | |
| 252 | + <dependency> | |
| 253 | + <groupId>org.projectlombok</groupId> | |
| 254 | + <artifactId>lombok</artifactId> | |
| 255 | + <version>${org.projectlombok.version}</version> | |
| 256 | + </dependency> | |
| 257 | + | |
| 258 | + <dependency> | |
| 259 | + <groupId>io.jsonwebtoken</groupId> | |
| 260 | + <artifactId>jjwt</artifactId> | |
| 261 | + <version>${jjwt.version}</version> | |
| 262 | + </dependency> | |
| 263 | + | |
| 264 | + <dependency> | |
| 265 | + <groupId>com.alibaba</groupId> | |
| 266 | + <artifactId>fastjson</artifactId> | |
| 267 | + <version>${fastjson.version}</version> | |
| 268 | + </dependency> | |
| 269 | + | |
| 270 | + <dependency> | |
| 271 | + <groupId>org.projectlombok</groupId> | |
| 272 | + <artifactId>lombok</artifactId> | |
| 273 | + <version>${org.projectlombok.version}</version> | |
| 274 | + </dependency> | |
| 275 | + | |
| 276 | + <dependency> | |
| 277 | + <!-- 解析客户端操作系统、浏览器等 TODO 芋艿:后面看看 hutool 有没替代 --> | |
| 278 | + <groupId>eu.bitwalker</groupId> | |
| 279 | + <artifactId>UserAgentUtils</artifactId> | |
| 280 | + <version>1.21</version> | |
| 281 | + </dependency> | |
| 282 | + | |
| 283 | + <dependency> | |
| 284 | + <groupId>cn.hutool</groupId> | |
| 285 | + <artifactId>hutool-core</artifactId> | |
| 286 | + <version>${hutool.version}</version> | |
| 287 | + </dependency> | |
| 288 | + </dependencies> | |
| 289 | + | |
| 290 | + | |
| 291 | + <build> | |
| 292 | + <pluginManagement> | |
| 293 | + <plugins> | |
| 294 | + <!-- 提供给 mapstruct 使用 --> | |
| 295 | + <plugin> | |
| 296 | + <groupId>org.apache.maven.plugins</groupId> | |
| 297 | + <artifactId>maven-compiler-plugin</artifactId> | |
| 298 | + <version>${maven-compiler-plugin.version}</version> | |
| 299 | + <configuration> | |
| 300 | + <source>${java.version}</source> <!-- or higher, depending on your project --> | |
| 301 | + <target>${java.version}</target> <!-- or higher, depending on your project --> | |
| 302 | + <annotationProcessorPaths> | |
| 303 | + <path> | |
| 304 | + <groupId>org.mapstruct</groupId> | |
| 305 | + <artifactId>mapstruct-processor</artifactId> | |
| 306 | + <version>${org.mapstruct.version}</version> | |
| 307 | + </path> | |
| 308 | + <path> | |
| 309 | + <groupId>org.projectlombok</groupId> | |
| 310 | + <artifactId>lombok</artifactId> | |
| 311 | + <version>${org.projectlombok.version}</version> | |
| 312 | + </path> | |
| 313 | + </annotationProcessorPaths> | |
| 314 | + </configuration> | |
| 315 | + </plugin> | |
| 316 | + | |
| 317 | + <!-- 打包 --> | |
| 318 | + <plugin> | |
| 319 | + <groupId>org.springframework.boot</groupId> | |
| 320 | + <artifactId>spring-boot-maven-plugin</artifactId> | |
| 321 | + <configuration> | |
| 322 | + <fork>true</fork> | |
| 323 | + </configuration> | |
| 324 | + </plugin> | |
| 325 | + </plugins> | |
| 326 | + </pluginManagement> | |
| 327 | + </build> | |
| 328 | + | |
| 329 | +</project> | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/swagger/config/SwaggerAutoConfiguration.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.framework.swagger.config; | |
| 2 | + | |
| 3 | +import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; | |
| 4 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | |
| 5 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | |
| 6 | +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | |
| 7 | +import org.springframework.boot.context.properties.EnableConfigurationProperties; | |
| 8 | +import org.springframework.context.annotation.Bean; | |
| 9 | +import org.springframework.context.annotation.Configuration; | |
| 10 | +import org.springframework.http.HttpHeaders; | |
| 11 | +import springfox.documentation.builders.ApiInfoBuilder; | |
| 12 | +import springfox.documentation.builders.PathSelectors; | |
| 13 | +import springfox.documentation.service.*; | |
| 14 | +import springfox.documentation.spi.DocumentationType; | |
| 15 | +import springfox.documentation.spi.service.contexts.SecurityContext; | |
| 16 | +import springfox.documentation.spring.web.plugins.Docket; | |
| 17 | +import springfox.documentation.swagger2.annotations.EnableSwagger2; | |
| 18 | +import springfox.documentation.service.ApiKey; | |
| 19 | + | |
| 20 | +import java.util.ArrayList; | |
| 21 | +import java.util.Arrays; | |
| 22 | +import java.util.Collections; | |
| 23 | +import java.util.List; | |
| 24 | + | |
| 25 | +import static springfox.documentation.builders.RequestHandlerSelectors.basePackage; | |
| 26 | + | |
| 27 | +/** | |
| 28 | + * Swagger2 自动配置类 | |
| 29 | + * | |
| 30 | + * @author 芋道源码 | |
| 31 | + */ | |
| 32 | +@Configuration | |
| 33 | +@EnableSwagger2 | |
| 34 | +@EnableKnife4j | |
| 35 | +@ConditionalOnClass({Docket.class, ApiInfoBuilder.class}) | |
| 36 | +@ConditionalOnProperty(prefix = "yudao.swagger", value = "enable", matchIfMissing = true) | |
| 37 | +// 允许使用 swagger.enable=false 禁用 Swagger | |
| 38 | +@EnableConfigurationProperties(SwaggerProperties.class) | |
| 39 | +public class SwaggerAutoConfiguration { | |
| 40 | + | |
| 41 | + @Bean | |
| 42 | + @ConditionalOnMissingBean | |
| 43 | + public SwaggerProperties swaggerProperties() { | |
| 44 | + return new SwaggerProperties(); | |
| 45 | + } | |
| 46 | + | |
| 47 | + @Bean | |
| 48 | + public Docket createRestApi() { | |
| 49 | + SwaggerProperties properties = swaggerProperties(); | |
| 50 | + // 创建 Docket 对象 | |
| 51 | + return new Docket(DocumentationType.SWAGGER_2) | |
| 52 | + // 用来创建该 API 的基本信息,展示在文档的页面中(自定义展示的信息) | |
| 53 | + .apiInfo(apiInfo(properties)) | |
| 54 | + // 设置扫描指定 package 包下的 | |
| 55 | + .select() | |
| 56 | + .apis(basePackage(properties.getBasePackage())) | |
| 57 | + .paths(PathSelectors.any()) | |
| 58 | + .build() | |
| 59 | + .securitySchemes(securitySchemes()) | |
| 60 | + .securityContexts(securityContexts()) | |
| 61 | +// .pathMapping() TODO 芋艿:稍后解决,统一 api 前缀 | |
| 62 | + ; | |
| 63 | + } | |
| 64 | + | |
| 65 | + /** | |
| 66 | + * API 摘要信息 | |
| 67 | + */ | |
| 68 | + private static ApiInfo apiInfo(SwaggerProperties properties) { | |
| 69 | + return new ApiInfoBuilder() | |
| 70 | + .title(properties.getTitle()) | |
| 71 | + .description(properties.getDescription()) | |
| 72 | + .contact(new Contact(properties.getAuthor(), null, null)) | |
| 73 | + .version(properties.getVersion()) | |
| 74 | + .build(); | |
| 75 | + } | |
| 76 | + | |
| 77 | + /** | |
| 78 | + * 安全模式,这里配置通过请求头 Authorization 传递 token 参数 | |
| 79 | + */ | |
| 80 | + private static List<SecurityScheme> securitySchemes() { | |
| 81 | + return Collections.singletonList(new ApiKey(HttpHeaders.AUTHORIZATION, "Authorization", "header")); | |
| 82 | + } | |
| 83 | + | |
| 84 | + /** | |
| 85 | + * 安全上下文 | |
| 86 | + * | |
| 87 | + * @see #securitySchemes() | |
| 88 | + * @see #authorizationScopes() | |
| 89 | + */ | |
| 90 | + private static List<SecurityContext> securityContexts() { | |
| 91 | + return Collections.singletonList(SecurityContext.builder() | |
| 92 | + .securityReferences(securityReferences()) | |
| 93 | + .forPaths(PathSelectors.regex("^(?!auth).*$")) | |
| 94 | + .build()); | |
| 95 | + } | |
| 96 | + | |
| 97 | + private static List<SecurityReference> securityReferences() { | |
| 98 | + return Collections.singletonList(new SecurityReference(HttpHeaders.AUTHORIZATION, authorizationScopes())); | |
| 99 | + } | |
| 100 | + | |
| 101 | + private static AuthorizationScope[] authorizationScopes() { | |
| 102 | + return new AuthorizationScope[]{new AuthorizationScope("global", "accessEverything")}; | |
| 103 | + } | |
| 104 | + | |
| 105 | +} | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/swagger/config/SwaggerProperties.java
0 → 100644
| 1 | +package cn.iocoder.dashboard.framework.swagger.config; | |
| 2 | + | |
| 3 | +import lombok.Data; | |
| 4 | +import org.springframework.boot.context.properties.ConfigurationProperties; | |
| 5 | + | |
| 6 | +import javax.validation.constraints.NotEmpty; | |
| 7 | + | |
| 8 | +/** | |
| 9 | + * Swagger 配置属性 | |
| 10 | + * | |
| 11 | + * @author 芋道源码 | |
| 12 | + */ | |
| 13 | +@ConfigurationProperties("yudao.swagger") | |
| 14 | +@Data | |
| 15 | +public class SwaggerProperties { | |
| 16 | + | |
| 17 | + /** | |
| 18 | + * 标题 | |
| 19 | + */ | |
| 20 | + @NotEmpty(message = "标题不能为空") | |
| 21 | + private String title; | |
| 22 | + /** | |
| 23 | + * 描述 | |
| 24 | + */ | |
| 25 | + @NotEmpty(message = "描述不能为空") | |
| 26 | + private String description; | |
| 27 | + /** | |
| 28 | + * 作者 | |
| 29 | + */ | |
| 30 | + @NotEmpty(message = "作者不能为空") | |
| 31 | + private String author; | |
| 32 | + /** | |
| 33 | + * 版本 | |
| 34 | + */ | |
| 35 | + @NotEmpty(message = "版本不能为空") | |
| 36 | + private String version; | |
| 37 | + /** | |
| 38 | + * 扫描的包 | |
| 39 | + */ | |
| 40 | + @NotEmpty(message = "扫描的 package 不能为空") | |
| 41 | + private String basePackage; | |
| 42 | + | |
| 43 | +} | ... | ... |
src/main/java/cn/iocoder/dashboard/framework/swagger/package-info.java
0 → 100644
src/main/java/cn/iocoder/dashboard/framework/swagger/《芋道 Spring Boot API 接口文档 Swagger 入门》.md
0 → 100644
| 1 | +<http://www.iocoder.cn/Spring-Boot/Swagger/?dashboard> | ... | ... |
src/main/resources/application.yaml
| 1 | 1 | spring: |
| 2 | - # 数据源配置项 | |
| 2 | + # 数据源配置项 TODO 多数据源;TODO 监控配置 | |
| 3 | 3 | datasource: |
| 4 | 4 | url: jdbc:mysql://127.0.1:3306/ruoyi-vue-pro?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=CTT |
| 5 | 5 | driver-class-name: com.mysql.jdbc.Driver |
| 6 | 6 | username: root |
| 7 | 7 | password: 123456 |
| 8 | + # redis 配置 TODO 需要进行下,对接到 redisson | |
| 9 | + redis: | |
| 10 | + # 地址 | |
| 11 | + host: localhost | |
| 12 | + # 端口,默认为6379 | |
| 13 | + port: 6379 | |
| 14 | + # 数据库索引 | |
| 15 | + database: 0 | |
| 16 | + # 连接超时时间 | |
| 17 | + timeout: 10s | |
| 18 | + | |
| 19 | +# 芋道配置项,设置当前项目所有自定义的配置 | |
| 20 | +yudao: | |
| 21 | + security: | |
| 22 | + token-header: Authorization | |
| 23 | + token-secret: abcdefghijklmnopqrstuvwxyz | |
| 24 | + token-expires: 30m | |
| 25 | + swagger: | |
| 26 | + title: 管理后台 | |
| 27 | + description: 提供管理员管理的所有功能 | |
| 28 | + version: 1.0.0 | |
| 29 | + base-package: cn.iocoder.dashboard.modules | ... | ... |