Commit 98697ee075585b5fb0d9f8fd2de0fdf9636edb86
1 parent
a8e8c14a
⬆️
Showing
1147 changed files
with
1979 additions
and
1937 deletions
Too many changes.
To preserve performance only 100 of 1147 files are displayed.
README.md
| 1 | +<p align="center"> | |
| 2 | + <img src="https://img.shields.io/badge/Spring%20Boot-3.2.0-blue.svg" alt="Downloads"> | |
| 3 | + <img src="https://img.shields.io/badge/Vue-3.2-blue.svg" alt="Downloads"> | |
| 4 | + <img src="https://img.shields.io/github/license/YunaiV/ruoyi-vue-pro"/> | |
| 5 | +</p> | |
| 6 | + | |
| 1 | 7 | **严肃声明:现在、未来都不会有商业版本,所有代码全部开源!!** |
| 2 | 8 | |
| 3 | 9 | **「我喜欢写代码,乐此不疲」** |
| ... | ... | @@ -15,8 +21,6 @@ |
| 15 | 21 | * 启动文档:<https://doc.iocoder.cn/quick-start/> |
| 16 | 22 | * 视频教程:<https://doc.iocoder.cn/video/> |
| 17 | 23 | |
| 18 | -已支持 Spring Boot 3.X + JDK 17 版本,可见 [master-boot3](https://gitee.com/zhijiantianya/ruoyi-vue-pro/blob/master/README.md) 分支。 | |
| 19 | - | |
| 20 | 24 | ## 🐯 平台简介 |
| 21 | 25 | |
| 22 | 26 | **芋道**,以开发者为中心,打造中国第一流的快速开发平台,全部开源,个人与企业可 100% 免费使用。 |
| ... | ... | @@ -27,6 +31,7 @@ |
| 27 | 31 | |
| 28 | 32 |  |
| 29 | 33 | |
| 34 | +* Java 后端:`master` 分支为 JDK 21 + Spring Boot 3.2.0,`master-jdk8` 分支为 JDK8 + Spring Boot 2.7.18 | |
| 30 | 35 | * 管理后台的电脑端:Vue3 提供 `element-plus`、`vben(ant-design-vue)` 两个版本,Vue2 提供 `element-ui` 版本 |
| 31 | 36 | * 管理后台的移动端:采用 `uni-app` 方案,一份代码多终端适配,同时支持 APP、小程序、H5! |
| 32 | 37 | * 后端采用 Spring Boot 多模块架构、MySQL + MyBatis Plus、Redis + Redisson |
| ... | ... | @@ -69,17 +74,19 @@ |
| 69 | 74 | |
| 70 | 75 | ## 🐰 分支说明 |
| 71 | 76 | |
| 72 | -| | JDK 8 完整版 | JDK 8 精简版 | JDK 17 完整版 | | |
| 73 | -|-------|-----------------------------------------------------------|--------------------------------------------------------------------|-----------------------------------------------------------------------------| | |
| 74 | -| 分支 | [`master`](https://gitee.com/zhijiantianya/ruoyi-vue-pro) | [`mini`](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/mini/) | [`master-boot3`](https://gitee.com/zhijiantianya/ruoyi-vue-pro/tree/master-boot3/) | | |
| 75 | -| 说明 | 包括所有功能 | 只保留核心功能 | 适配 Spring Boot 3.X | | |
| 76 | -| 系统功能 | √ | √ | √ | | |
| 77 | -| 基础设施 | √ | √ | √ | | |
| 78 | -| 会员中心 | √ | √ | √ | | |
| 79 | -| 工作流程 | √ | x | √ | | |
| 80 | -| 数据报表 | √ | x | 适配中 | | |
| 81 | -| 商城系统 | √ | x | √ | | |
| 82 | -| 微信公众号 | √ | x | √ | | |
| 77 | +### ⬅️ 完整版 | |
| 78 | + | |
| 79 | +【完整版】包括系统功能、基础设施、会员中心、数据报表、工作流程、商城系统、微信公众号、客户管理系统等功能。 | |
| 80 | + | |
| 81 | +* JDK 21 + Spring Boot 3.2.0 版本:<https://gitee.com/zhijiantianya/ruoyi-vue-pro> 的 `master` 分支 | |
| 82 | +* JDK 8 + Spring Boot 2.7.18 版本:<https://gitee.com/zhijiantianya/ruoyi-vue-pro> 的 `master-jdk8` 分支 | |
| 83 | + | |
| 84 | +### ➡️️ 精简版 | |
| 85 | + | |
| 86 | +【精简版】只包括系统功能、基础设施功能,不包括会员中心、数据报表、工作流程、商城系统、微信公众号等功能。 | |
| 87 | + | |
| 88 | +* JDK 21 + Spring Boot 3.2.0 版本:<https://gitee.com/yudaocode/yudao-boot-mini> 的 `master` 分支 | |
| 89 | +* JDK 8 + Spring Boot 2.7.18 版本:<https://gitee.com/yudaocode/yudao-boot-mini> 的 `master-jdk8` 分支 | |
| 83 | 90 | |
| 84 | 91 | ## 😎 开源协议 |
| 85 | 92 | |
| ... | ... | @@ -258,27 +265,27 @@ _前端基于 crmeb uniapp 经过授权重构,优化代码实现,接入芋 |
| 258 | 265 | |
| 259 | 266 | | 框架 | 说明 | 版本 | 学习指南 | |
| 260 | 267 | |---------------------------------------------------------------------------------------------|------------------|----------------|----------------------------------------------------------------| |
| 261 | -| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.7.17 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | |
| 268 | +| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 3.2.0 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | |
| 262 | 269 | | [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 / 8.0+ | | |
| 263 | -| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.19 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 264 | -| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | | |
| 265 | -| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.6.1 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 270 | +| [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.20 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 271 | +| [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | | |
| 272 | +| [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 4.2.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | |
| 266 | 273 | | [Redis](https://redis.io/) | key-value 数据库 | 5.0 / 6.0 /7.0 | | |
| 267 | -| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.18.0 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | | |
| 268 | -| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.24 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | |
| 269 | -| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.7.11 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | |
| 270 | -| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.5 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | |
| 271 | -| [Flowable](https://github.com/flowable/flowable-engine) | 工作流引擎 | 6.8.0 | [文档](https://doc.iocoder.cn/bpm/) | | |
| 274 | +| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.25.0 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | | |
| 275 | +| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 6.1.1 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | |
| 276 | +| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 6.2.0 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | |
| 277 | +| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 8.0.1 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | |
| 278 | +| [Flowable](https://github.com/flowable/flowable-engine) | 工作流引擎 | 7.0.0 | [文档](https://doc.iocoder.cn/bpm/) | | |
| 272 | 279 | | [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) | |
| 273 | -| [Springdoc](https://springdoc.org/) | Swagger 文档 | 1.6.15 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | | |
| 274 | -| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.1 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | |
| 275 | -| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.12.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | | |
| 276 | -| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.7.10 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | | |
| 277 | -| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.13.3 | | | |
| 280 | +| [Springdoc](https://springdoc.org/) | Swagger 文档 | 2.2.0 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | | |
| 281 | +| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 2.1.0 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | |
| 282 | +| [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 9.0.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | | |
| 283 | +| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 3.1.8 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | | |
| 284 | +| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.15.3 | | | |
| 278 | 285 | | [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.5.5.Final | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | |
| 279 | 286 | | [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.18.30 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | |
| 280 | -| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.8.2 | - | | |
| 281 | -| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 4.8.0 | - | | |
| 287 | +| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.10.1 | - | | |
| 288 | +| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 5.7.0 | - | | |
| 282 | 289 | |
| 283 | 290 | ## 🐷 演示图 |
| 284 | 291 | ... | ... |
pom.xml
| ... | ... | @@ -31,17 +31,17 @@ |
| 31 | 31 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> |
| 32 | 32 | |
| 33 | 33 | <properties> |
| 34 | - <revision>1.9.0-snapshot</revision> | |
| 34 | + <revision>2.0.0-snapshot</revision> | |
| 35 | 35 | <!-- Maven 相关 --> |
| 36 | - <java.version>1.8</java.version> | |
| 36 | + <java.version>21</java.version> | |
| 37 | 37 | <maven.compiler.source>${java.version}</maven.compiler.source> |
| 38 | 38 | <maven.compiler.target>${java.version}</maven.compiler.target> |
| 39 | - <maven-surefire-plugin.version>3.0.0-M5</maven-surefire-plugin.version> | |
| 40 | - <maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version> | |
| 39 | + <maven-surefire-plugin.version>3.2.2</maven-surefire-plugin.version> | |
| 40 | + <maven-compiler-plugin.version>3.11.0</maven-compiler-plugin.version> | |
| 41 | 41 | <flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version> |
| 42 | 42 | <!-- 看看咋放到 bom 里 --> |
| 43 | 43 | <lombok.version>1.18.30</lombok.version> |
| 44 | - <spring.boot.version>2.7.17</spring.boot.version> | |
| 44 | + <spring.boot.version>3.2.0</spring.boot.version> | |
| 45 | 45 | <mapstruct.version>1.5.5.Final</mapstruct.version> |
| 46 | 46 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 47 | 47 | </properties> |
| ... | ... | @@ -92,6 +92,11 @@ |
| 92 | 92 | <version>${mapstruct.version}</version> |
| 93 | 93 | </path> |
| 94 | 94 | </annotationProcessorPaths> |
| 95 | + <!-- 编译参数写在 arg 内,解决 Spring Boot 3.2 的 Parameter Name Discovery 问题 --> | |
| 96 | + <debug>false</debug> | |
| 97 | + <compilerArgs> | |
| 98 | + <arg>-parameters</arg> | |
| 99 | + </compilerArgs> | |
| 95 | 100 | </configuration> |
| 96 | 101 | </plugin> |
| 97 | 102 | <plugin> | ... | ... |
yudao-dependencies/pom.xml
| ... | ... | @@ -14,53 +14,53 @@ |
| 14 | 14 | <url>https://github.com/YunaiV/ruoyi-vue-pro</url> |
| 15 | 15 | |
| 16 | 16 | <properties> |
| 17 | - <revision>1.9.0-snapshot</revision> | |
| 17 | + <revision>2.0.0-snapshot</revision> | |
| 18 | 18 | <flatten-maven-plugin.version>1.5.0</flatten-maven-plugin.version> |
| 19 | 19 | <!-- 统一依赖管理 --> |
| 20 | - <spring.boot.version>2.7.17</spring.boot.version> | |
| 20 | + <spring.boot.version>3.2.0</spring.boot.version> | |
| 21 | 21 | <!-- Web 相关 --> |
| 22 | - <springdoc.version>1.6.15</springdoc.version> | |
| 22 | + <springdoc.version>2.2.0</springdoc.version> | |
| 23 | 23 | <knife4j.version>4.3.0</knife4j.version> |
| 24 | - <servlet.versoin>2.5</servlet.versoin> | |
| 25 | 24 | <!-- DB 相关 --> |
| 26 | 25 | <druid.version>1.2.20</druid.version> |
| 27 | - <mybatis-plus.version>3.5.4</mybatis-plus.version> | |
| 28 | - <mybatis-plus-generator.version>3.5.4</mybatis-plus-generator.version> | |
| 29 | - <dynamic-datasource.version>3.6.1</dynamic-datasource.version> | |
| 30 | - <mybatis-plus-join.version>1.4.7</mybatis-plus-join.version> | |
| 31 | - <redisson.version>3.18.0</redisson.version> | |
| 26 | + <mybatis-plus.version>3.5.4.1</mybatis-plus.version> | |
| 27 | + <mybatis-plus-generator.version>3.5.4.1</mybatis-plus-generator.version> | |
| 28 | + <dynamic-datasource.version>4.2.0</dynamic-datasource.version> | |
| 29 | + <mybatis-plus-join.version>1.4.7.2</mybatis-plus-join.version> | |
| 30 | + <redisson.version>3.25.0</redisson.version> | |
| 32 | 31 | <dm8.jdbc.version>8.1.3.62</dm8.jdbc.version> |
| 33 | 32 | <!-- 消息队列 --> |
| 34 | 33 | <rocketmq-spring.version>2.2.3</rocketmq-spring.version> |
| 35 | 34 | <!-- 服务保障相关 --> |
| 36 | 35 | <lock4j.version>2.2.5</lock4j.version> |
| 37 | - <resilience4j.version>1.7.1</resilience4j.version> | |
| 36 | + <resilience4j.version>2.1.0</resilience4j.version> | |
| 38 | 37 | <!-- 监控相关 --> |
| 39 | - <skywalking.version>8.12.0</skywalking.version> | |
| 40 | - <spring-boot-admin.version>2.7.11</spring-boot-admin.version> | |
| 38 | + <skywalking.version>9.0.0</skywalking.version> | |
| 39 | + <spring-boot-admin.version>3.1.8</spring-boot-admin.version> | |
| 41 | 40 | <opentracing.version>0.33.0</opentracing.version> |
| 42 | 41 | <!-- Test 测试相关 --> |
| 43 | - <podam.version>7.2.11.RELEASE</podam.version> | |
| 44 | - <jedis-mock.version>1.0.7</jedis-mock.version> | |
| 45 | - <mockito-inline.version>4.11.0</mockito-inline.version> | |
| 42 | + <podam.version>8.0.0.RELEASE</podam.version> | |
| 43 | + <jedis-mock.version>1.0.12</jedis-mock.version> | |
| 44 | + <mockito-inline.version>5.2.0</mockito-inline.version> | |
| 46 | 45 | <!-- Bpm 工作流相关 --> |
| 47 | - <flowable.version>6.8.0</flowable.version> | |
| 46 | + <flowable.version>7.0.0</flowable.version> | |
| 48 | 47 | <!-- 工具类相关 --> |
| 49 | - <captcha-plus.version>1.0.10</captcha-plus.version> | |
| 50 | - <jsoup.version>1.16.2</jsoup.version> | |
| 48 | + <captcha-plus.version>2.0.3</captcha-plus.version> | |
| 49 | + <jsoup.version>1.17.1</jsoup.version> | |
| 51 | 50 | <lombok.version>1.18.30</lombok.version> |
| 52 | 51 | <mapstruct.version>1.5.5.Final</mapstruct.version> |
| 53 | - <hutool.version>5.8.22</hutool.version> | |
| 52 | + <hutool-5.version>5.8.23</hutool-5.version> | |
| 53 | + <hutool-6.version>6.0.0-M8</hutool-6.version> | |
| 54 | 54 | <easyexcel.verion>3.3.2</easyexcel.verion> |
| 55 | 55 | <velocity.version>2.3</velocity.version> |
| 56 | 56 | <screw.version>1.0.5</screw.version> |
| 57 | 57 | <fastjson.version>1.2.83</fastjson.version> |
| 58 | 58 | <guava.version>32.1.3-jre</guava.version> |
| 59 | 59 | <guice.version>5.1.0</guice.version> |
| 60 | - <transmittable-thread-local.version>2.14.2</transmittable-thread-local.version> | |
| 60 | + <transmittable-thread-local.version>2.14.4</transmittable-thread-local.version> | |
| 61 | 61 | <commons-net.version>3.10.0</commons-net.version> |
| 62 | 62 | <jsch.version>0.1.55</jsch.version> |
| 63 | - <tika-core.version>2.7.0</tika-core.version> | |
| 63 | + <tika-core.version>2.9.1</tika-core.version> | |
| 64 | 64 | <ip2region.version>2.7.0</ip2region.version> |
| 65 | 65 | <!-- 三方云服务相关 --> |
| 66 | 66 | <okio.version>3.5.0</okio.version> |
| ... | ... | @@ -70,7 +70,7 @@ |
| 70 | 70 | <aliyun-java-sdk-core.version>4.6.4</aliyun-java-sdk-core.version> |
| 71 | 71 | <aliyun-java-sdk-dysmsapi.version>2.2.1</aliyun-java-sdk-dysmsapi.version> |
| 72 | 72 | <tencentcloud-sdk-java.version>3.1.880</tencentcloud-sdk-java.version> |
| 73 | - <justauth.version>1.0.8</justauth.version> | |
| 73 | + <justauth.version>2.0.5</justauth.version> | |
| 74 | 74 | <jimureport.version>1.6.1</jimureport.version> |
| 75 | 75 | <xercesImpl.version>2.12.2</xercesImpl.version> |
| 76 | 76 | <weixin-java.version>4.5.7.B</weixin-java.version> |
| ... | ... | @@ -126,11 +126,6 @@ |
| 126 | 126 | </dependency> |
| 127 | 127 | <dependency> |
| 128 | 128 | <groupId>cn.iocoder.boot</groupId> |
| 129 | - <artifactId>yudao-spring-boot-starter-biz-social</artifactId> | |
| 130 | - <version>${revision}</version> | |
| 131 | - </dependency> | |
| 132 | - <dependency> | |
| 133 | - <groupId>cn.iocoder.boot</groupId> | |
| 134 | 129 | <artifactId>yudao-spring-boot-starter-biz-error-code</artifactId> |
| 135 | 130 | <version>${revision}</version> |
| 136 | 131 | </dependency> |
| ... | ... | @@ -179,11 +174,16 @@ |
| 179 | 174 | |
| 180 | 175 | <dependency> |
| 181 | 176 | <groupId>com.github.xiaoymin</groupId> |
| 182 | - <artifactId>knife4j-openapi3-spring-boot-starter</artifactId> | |
| 177 | + <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> | |
| 183 | 178 | <version>${knife4j.version}</version> |
| 184 | 179 | </dependency> |
| 185 | 180 | <dependency> |
| 186 | 181 | <groupId>org.springdoc</groupId> |
| 182 | + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> | |
| 183 | + <version>${springdoc.version}</version> | |
| 184 | + </dependency> | |
| 185 | + <dependency> | |
| 186 | + <groupId>org.springdoc</groupId> | |
| 187 | 187 | <artifactId>springdoc-openapi-ui</artifactId> |
| 188 | 188 | <version>${springdoc.version}</version> |
| 189 | 189 | </dependency> |
| ... | ... | @@ -197,12 +197,12 @@ |
| 197 | 197 | |
| 198 | 198 | <dependency> |
| 199 | 199 | <groupId>com.alibaba</groupId> |
| 200 | - <artifactId>druid-spring-boot-starter</artifactId> | |
| 200 | + <artifactId>druid-spring-boot-3-starter</artifactId> | |
| 201 | 201 | <version>${druid.version}</version> |
| 202 | 202 | </dependency> |
| 203 | 203 | <dependency> |
| 204 | 204 | <groupId>com.baomidou</groupId> |
| 205 | - <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 205 | + <artifactId>mybatis-plus-spring-boot3-starter</artifactId> | |
| 206 | 206 | <version>${mybatis-plus.version}</version> |
| 207 | 207 | </dependency> |
| 208 | 208 | <dependency> |
| ... | ... | @@ -212,7 +212,7 @@ |
| 212 | 212 | </dependency> |
| 213 | 213 | <dependency> |
| 214 | 214 | <groupId>com.baomidou</groupId> |
| 215 | - <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> | |
| 215 | + <artifactId>dynamic-datasource-spring-boot3-starter</artifactId> <!-- 多数据源 --> | |
| 216 | 216 | <version>${dynamic-datasource.version}</version> |
| 217 | 217 | </dependency> |
| 218 | 218 | <dependency> |
| ... | ... | @@ -458,7 +458,12 @@ |
| 458 | 458 | <dependency> |
| 459 | 459 | <groupId>cn.hutool</groupId> |
| 460 | 460 | <artifactId>hutool-all</artifactId> |
| 461 | - <version>${hutool.version}</version> | |
| 461 | + <version>${hutool-5.version}</version> | |
| 462 | + </dependency> | |
| 463 | + <dependency> | |
| 464 | + <groupId>org.dromara.hutool</groupId> | |
| 465 | + <artifactId>hutool-all</artifactId> | |
| 466 | + <version>${hutool-6.version}</version> | |
| 462 | 467 | </dependency> |
| 463 | 468 | |
| 464 | 469 | <dependency> | ... | ... |
yudao-example/yudao-sso-demo-by-code/pom.xml
| ... | ... | @@ -17,11 +17,11 @@ |
| 17 | 17 | |
| 18 | 18 | <properties> |
| 19 | 19 | <!-- Maven 相关 --> |
| 20 | - <maven.compiler.source>8</maven.compiler.source> | |
| 21 | - <maven.compiler.target>8</maven.compiler.target> | |
| 20 | + <maven.compiler.source>21</maven.compiler.source> | |
| 21 | + <maven.compiler.target>21</maven.compiler.target> | |
| 22 | 22 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 23 | 23 | <!-- 统一依赖管理 --> |
| 24 | - <spring.boot.version>2.7.17</spring.boot.version> | |
| 24 | + <spring.boot.version>3.2.0</spring.boot.version> | |
| 25 | 25 | </properties> |
| 26 | 26 | |
| 27 | 27 | <dependencyManagement> | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/controller/AuthController.java
| ... | ... | @@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | 11 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | |
| 13 | -import javax.annotation.Resource; | |
| 14 | -import javax.servlet.http.HttpServletRequest; | |
| 13 | +import jakarta.annotation.Resource; | |
| 14 | +import jakarta.servlet.http.HttpServletRequest; | |
| 15 | 15 | |
| 16 | 16 | @RestController |
| 17 | 17 | @RequestMapping("/auth") | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/controller/UserController.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO; |
| 6 | 6 | import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO; |
| 7 | 7 | import org.springframework.web.bind.annotation.*; |
| 8 | 8 | |
| 9 | -import javax.annotation.Resource; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | 10 | |
| 11 | 11 | @RestController |
| 12 | 12 | @RequestMapping("/user") | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
| ... | ... | @@ -5,13 +5,15 @@ import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl; |
| 5 | 5 | import org.springframework.context.annotation.Bean; |
| 6 | 6 | import org.springframework.context.annotation.Configuration; |
| 7 | 7 | import org.springframework.http.HttpMethod; |
| 8 | +import org.springframework.security.config.Customizer; | |
| 8 | 9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| 9 | 10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| 11 | +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; | |
| 10 | 12 | import org.springframework.security.web.AuthenticationEntryPoint; |
| 11 | 13 | import org.springframework.security.web.SecurityFilterChain; |
| 12 | 14 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| 13 | 15 | |
| 14 | -import javax.annotation.Resource; | |
| 16 | +import jakarta.annotation.Resource; | |
| 15 | 17 | |
| 16 | 18 | @Configuration(proxyBeanMethods = false) |
| 17 | 19 | @EnableWebSecurity |
| ... | ... | @@ -28,21 +30,25 @@ public class SecurityConfiguration{ |
| 28 | 30 | @Bean |
| 29 | 31 | protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { |
| 30 | 32 | // 设置 URL 安全权限 |
| 31 | - httpSecurity.csrf().disable() // 禁用 CSRF 保护 | |
| 32 | - .authorizeRequests() | |
| 33 | - // 1. 静态资源,可匿名访问 | |
| 34 | - .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() | |
| 35 | - // 2. 登录相关的接口,可匿名访问 | |
| 36 | - .antMatchers("/auth/login-by-code").permitAll() | |
| 37 | - .antMatchers("/auth/refresh-token").permitAll() | |
| 38 | - .antMatchers("/auth/logout").permitAll() | |
| 39 | - // last. 兜底规则,必须认证 | |
| 40 | - .and().authorizeRequests() | |
| 41 | - .anyRequest().authenticated(); | |
| 42 | - | |
| 43 | - // 设置处理器 | |
| 44 | - httpSecurity.exceptionHandling().accessDeniedHandler(accessDeniedHandler) | |
| 45 | - .authenticationEntryPoint(authenticationEntryPoint); | |
| 33 | + httpSecurity | |
| 34 | + // 开启跨域 | |
| 35 | + .cors(Customizer.withDefaults()) | |
| 36 | + // CSRF 禁用,因为不使用 Session | |
| 37 | + .csrf(AbstractHttpConfigurer::disable) | |
| 38 | + // 一堆自定义的 Spring Security 处理器 | |
| 39 | + .exceptionHandling(c -> c.authenticationEntryPoint(authenticationEntryPoint) | |
| 40 | + .accessDeniedHandler(accessDeniedHandler)); | |
| 41 | + | |
| 42 | + // 设置每个请求的权限 | |
| 43 | + httpSecurity.authorizeHttpRequests(c -> c | |
| 44 | + // 1. 静态资源,可匿名访问 | |
| 45 | + .requestMatchers(HttpMethod.GET, "/*.html", "/*.html", "/*.css", "/*.js").permitAll() | |
| 46 | + // 2. 登录相关的接口,可匿名访问 | |
| 47 | + .requestMatchers("/auth/login-by-code").permitAll() | |
| 48 | + .requestMatchers("/auth/refresh-token").permitAll() | |
| 49 | + .requestMatchers("/auth/logout").permitAll()) | |
| 50 | + // 3. 兜底规则,必须认证 | |
| 51 | + .authorizeHttpRequests(c -> c.anyRequest().authenticated()); | |
| 46 | 52 | |
| 47 | 53 | // 添加 Token Filter |
| 48 | 54 | httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/filter/TokenAuthenticationFilter.java
| ... | ... | @@ -9,11 +9,11 @@ import org.springframework.stereotype.Component; |
| 9 | 9 | import org.springframework.util.StringUtils; |
| 10 | 10 | import org.springframework.web.filter.OncePerRequestFilter; |
| 11 | 11 | |
| 12 | -import javax.annotation.Resource; | |
| 13 | -import javax.servlet.FilterChain; | |
| 14 | -import javax.servlet.ServletException; | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | +import jakarta.annotation.Resource; | |
| 13 | +import jakarta.servlet.FilterChain; | |
| 14 | +import jakarta.servlet.ServletException; | |
| 15 | +import jakarta.servlet.http.HttpServletRequest; | |
| 16 | +import jakarta.servlet.http.HttpServletResponse; | |
| 17 | 17 | import java.io.IOException; |
| 18 | 18 | |
| 19 | 19 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/handler/AccessDeniedHandlerImpl.java
| ... | ... | @@ -10,10 +10,10 @@ import org.springframework.security.web.access.AccessDeniedHandler; |
| 10 | 10 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 11 | 11 | import org.springframework.stereotype.Component; |
| 12 | 12 | |
| 13 | -import javax.servlet.FilterChain; | |
| 14 | -import javax.servlet.ServletException; | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 13 | +import jakarta.servlet.FilterChain; | |
| 14 | +import jakarta.servlet.ServletException; | |
| 15 | +import jakarta.servlet.http.HttpServletRequest; | |
| 16 | +import jakarta.servlet.http.HttpServletResponse; | |
| 17 | 17 | import java.io.IOException; |
| 18 | 18 | |
| 19 | 19 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/handler/AuthenticationEntryPointImpl.java
| ... | ... | @@ -9,9 +9,9 @@ import org.springframework.security.web.AuthenticationEntryPoint; |
| 9 | 9 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 10 | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | |
| 12 | -import javax.servlet.FilterChain; | |
| 13 | -import javax.servlet.http.HttpServletRequest; | |
| 14 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | +import jakarta.servlet.FilterChain; | |
| 13 | +import jakarta.servlet.http.HttpServletRequest; | |
| 14 | +import jakarta.servlet.http.HttpServletResponse; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 访问一个需要认证的 URL 资源,但是此时自己尚未认证(登录)的情况下,返回 {@link GlobalErrorCodeConstants#UNAUTHORIZED} 错误码,从而使前端重定向到登录页 | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/util/SecurityUtils.java
| ... | ... | @@ -9,7 +9,7 @@ import org.springframework.security.core.context.SecurityContextHolder; |
| 9 | 9 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
| 10 | 10 | import org.springframework.util.StringUtils; |
| 11 | 11 | |
| 12 | -import javax.servlet.http.HttpServletRequest; | |
| 12 | +import jakarta.servlet.http.HttpServletRequest; | |
| 13 | 13 | import java.util.Collections; |
| 14 | 14 | |
| 15 | 15 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-code/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/util/ServletUtils.java
| 1 | 1 | package cn.iocoder.yudao.ssodemo.framework.core.util; |
| 2 | 2 | |
| 3 | +import cn.hutool.extra.servlet.JakartaServletUtil; | |
| 3 | 4 | import cn.hutool.extra.servlet.ServletUtil; |
| 4 | 5 | import cn.hutool.json.JSONUtil; |
| 5 | 6 | import org.springframework.http.MediaType; |
| 6 | 7 | |
| 7 | -import javax.servlet.http.HttpServletResponse; | |
| 8 | +import jakarta.servlet.http.HttpServletResponse; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * 客户端工具类 |
| ... | ... | @@ -22,11 +23,11 @@ public class ServletUtils { |
| 22 | 23 | @SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码 |
| 23 | 24 | public static void writeJSON(HttpServletResponse response, Object object) { |
| 24 | 25 | String content = JSONUtil.toJsonStr(object); |
| 25 | - ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 26 | + JakartaServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | public static void write(HttpServletResponse response, String text, String contentType) { |
| 29 | - ServletUtil.write(response, text, contentType); | |
| 30 | + JakartaServletUtil.write(response, text, contentType); | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | } | ... | ... |
yudao-example/yudao-sso-demo-by-password/pom.xml
| ... | ... | @@ -17,11 +17,11 @@ |
| 17 | 17 | |
| 18 | 18 | <properties> |
| 19 | 19 | <!-- Maven 相关 --> |
| 20 | - <maven.compiler.source>8</maven.compiler.source> | |
| 21 | - <maven.compiler.target>8</maven.compiler.target> | |
| 20 | + <maven.compiler.source>21</maven.compiler.source> | |
| 21 | + <maven.compiler.target>21</maven.compiler.target> | |
| 22 | 22 | <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
| 23 | 23 | <!-- 统一依赖管理 --> |
| 24 | - <spring.boot.version>2.7.17</spring.boot.version> | |
| 24 | + <spring.boot.version>3.2.0</spring.boot.version> | |
| 25 | 25 | </properties> |
| 26 | 26 | |
| 27 | 27 | <dependencyManagement> | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/controller/AuthController.java
| ... | ... | @@ -10,8 +10,8 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 10 | 10 | import org.springframework.web.bind.annotation.RequestParam; |
| 11 | 11 | import org.springframework.web.bind.annotation.RestController; |
| 12 | 12 | |
| 13 | -import javax.annotation.Resource; | |
| 14 | -import javax.servlet.http.HttpServletRequest; | |
| 13 | +import jakarta.annotation.Resource; | |
| 14 | +import jakarta.servlet.http.HttpServletRequest; | |
| 15 | 15 | |
| 16 | 16 | @RestController |
| 17 | 17 | @RequestMapping("/auth") | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/controller/UserController.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.ssodemo.client.dto.user.UserInfoRespDTO; |
| 6 | 6 | import cn.iocoder.yudao.ssodemo.client.dto.user.UserUpdateReqDTO; |
| 7 | 7 | import org.springframework.web.bind.annotation.*; |
| 8 | 8 | |
| 9 | -import javax.annotation.Resource; | |
| 9 | +import jakarta.annotation.Resource; | |
| 10 | 10 | |
| 11 | 11 | @RestController |
| 12 | 12 | @RequestMapping("/user") | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/config/SecurityConfiguration.java
| ... | ... | @@ -5,13 +5,15 @@ import cn.iocoder.yudao.ssodemo.framework.core.handler.AccessDeniedHandlerImpl; |
| 5 | 5 | import org.springframework.context.annotation.Bean; |
| 6 | 6 | import org.springframework.context.annotation.Configuration; |
| 7 | 7 | import org.springframework.http.HttpMethod; |
| 8 | +import org.springframework.security.config.Customizer; | |
| 8 | 9 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| 9 | 10 | import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; |
| 11 | +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; | |
| 10 | 12 | import org.springframework.security.web.AuthenticationEntryPoint; |
| 11 | 13 | import org.springframework.security.web.SecurityFilterChain; |
| 12 | 14 | import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter; |
| 13 | 15 | |
| 14 | -import javax.annotation.Resource; | |
| 16 | +import jakarta.annotation.Resource; | |
| 15 | 17 | |
| 16 | 18 | @Configuration(proxyBeanMethods = false) |
| 17 | 19 | @EnableWebSecurity |
| ... | ... | @@ -28,21 +30,25 @@ public class SecurityConfiguration { |
| 28 | 30 | @Bean |
| 29 | 31 | protected SecurityFilterChain filterChain(HttpSecurity httpSecurity) throws Exception { |
| 30 | 32 | // 设置 URL 安全权限 |
| 31 | - httpSecurity.csrf().disable() // 禁用 CSRF 保护 | |
| 32 | - .authorizeRequests() | |
| 33 | + httpSecurity | |
| 34 | + // 开启跨域 | |
| 35 | + .cors(Customizer.withDefaults()) | |
| 36 | + // CSRF 禁用,因为不使用 Session | |
| 37 | + .csrf(AbstractHttpConfigurer::disable) | |
| 38 | + // 一堆自定义的 Spring Security 处理器 | |
| 39 | + .exceptionHandling(c -> c.authenticationEntryPoint(authenticationEntryPoint) | |
| 40 | + .accessDeniedHandler(accessDeniedHandler)); | |
| 41 | + | |
| 42 | + // 设置每个请求的权限 | |
| 43 | + httpSecurity.authorizeHttpRequests(c -> c | |
| 33 | 44 | // 1. 静态资源,可匿名访问 |
| 34 | - .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() | |
| 45 | + .requestMatchers(HttpMethod.GET, "/*.html", "/*.html", "/*.css", "/*.js").permitAll() | |
| 35 | 46 | // 2. 登录相关的接口,可匿名访问 |
| 36 | - .antMatchers("/auth/login-by-code").permitAll() | |
| 37 | - .antMatchers("/auth/refresh-token").permitAll() | |
| 38 | - .antMatchers("/auth/logout").permitAll() | |
| 39 | - // last. 兜底规则,必须认证 | |
| 40 | - .and().authorizeRequests() | |
| 41 | - .anyRequest().authenticated(); | |
| 42 | - | |
| 43 | - // 设置处理器 | |
| 44 | - httpSecurity.exceptionHandling().accessDeniedHandler(accessDeniedHandler) | |
| 45 | - .authenticationEntryPoint(authenticationEntryPoint); | |
| 47 | + .requestMatchers("/auth/login-by-code").permitAll() | |
| 48 | + .requestMatchers("/auth/refresh-token").permitAll() | |
| 49 | + .requestMatchers("/auth/logout").permitAll()) | |
| 50 | + // 3. 兜底规则,必须认证 | |
| 51 | + .authorizeHttpRequests(c -> c.anyRequest().authenticated()); | |
| 46 | 52 | |
| 47 | 53 | // 添加 Token Filter |
| 48 | 54 | httpSecurity.addFilterBefore(tokenAuthenticationFilter, UsernamePasswordAuthenticationFilter.class); | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/filter/TokenAuthenticationFilter.java
| ... | ... | @@ -9,11 +9,11 @@ import org.springframework.stereotype.Component; |
| 9 | 9 | import org.springframework.util.StringUtils; |
| 10 | 10 | import org.springframework.web.filter.OncePerRequestFilter; |
| 11 | 11 | |
| 12 | -import javax.annotation.Resource; | |
| 13 | -import javax.servlet.FilterChain; | |
| 14 | -import javax.servlet.ServletException; | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | +import jakarta.annotation.Resource; | |
| 13 | +import jakarta.servlet.FilterChain; | |
| 14 | +import jakarta.servlet.ServletException; | |
| 15 | +import jakarta.servlet.http.HttpServletRequest; | |
| 16 | +import jakarta.servlet.http.HttpServletResponse; | |
| 17 | 17 | import java.io.IOException; |
| 18 | 18 | |
| 19 | 19 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/handler/AccessDeniedHandlerImpl.java
| ... | ... | @@ -10,10 +10,10 @@ import org.springframework.security.web.access.AccessDeniedHandler; |
| 10 | 10 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 11 | 11 | import org.springframework.stereotype.Component; |
| 12 | 12 | |
| 13 | -import javax.servlet.FilterChain; | |
| 14 | -import javax.servlet.ServletException; | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 13 | +import jakarta.servlet.FilterChain; | |
| 14 | +import jakarta.servlet.ServletException; | |
| 15 | +import jakarta.servlet.http.HttpServletRequest; | |
| 16 | +import jakarta.servlet.http.HttpServletResponse; | |
| 17 | 17 | import java.io.IOException; |
| 18 | 18 | |
| 19 | 19 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/handler/AuthenticationEntryPointImpl.java
| ... | ... | @@ -9,9 +9,9 @@ import org.springframework.security.web.AuthenticationEntryPoint; |
| 9 | 9 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 10 | 10 | import org.springframework.stereotype.Component; |
| 11 | 11 | |
| 12 | -import javax.servlet.FilterChain; | |
| 13 | -import javax.servlet.http.HttpServletRequest; | |
| 14 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | +import jakarta.servlet.FilterChain; | |
| 13 | +import jakarta.servlet.http.HttpServletRequest; | |
| 14 | +import jakarta.servlet.http.HttpServletResponse; | |
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * 访问一个需要认证的 URL 资源,但是此时自己尚未认证(登录)的情况下,返回 {@link GlobalErrorCodeConstants#UNAUTHORIZED} 错误码,从而使前端重定向到登录页 | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/util/SecurityUtils.java
| ... | ... | @@ -9,7 +9,7 @@ import org.springframework.security.core.context.SecurityContextHolder; |
| 9 | 9 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
| 10 | 10 | import org.springframework.util.StringUtils; |
| 11 | 11 | |
| 12 | -import javax.servlet.http.HttpServletRequest; | |
| 12 | +import jakarta.servlet.http.HttpServletRequest; | |
| 13 | 13 | import java.util.Collections; |
| 14 | 14 | |
| 15 | 15 | /** | ... | ... |
yudao-example/yudao-sso-demo-by-password/src/main/java/cn/iocoder/yudao/ssodemo/framework/core/util/ServletUtils.java
| 1 | 1 | package cn.iocoder.yudao.ssodemo.framework.core.util; |
| 2 | 2 | |
| 3 | +import cn.hutool.extra.servlet.JakartaServletUtil; | |
| 3 | 4 | import cn.hutool.extra.servlet.ServletUtil; |
| 4 | 5 | import cn.hutool.json.JSONUtil; |
| 5 | 6 | import org.springframework.http.MediaType; |
| 6 | 7 | |
| 7 | -import javax.servlet.http.HttpServletResponse; | |
| 8 | +import jakarta.servlet.http.HttpServletResponse; | |
| 8 | 9 | |
| 9 | 10 | /** |
| 10 | 11 | * 客户端工具类 |
| ... | ... | @@ -22,11 +23,11 @@ public class ServletUtils { |
| 22 | 23 | @SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码 |
| 23 | 24 | public static void writeJSON(HttpServletResponse response, Object object) { |
| 24 | 25 | String content = JSONUtil.toJsonStr(object); |
| 25 | - ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 26 | + JakartaServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 26 | 27 | } |
| 27 | 28 | |
| 28 | 29 | public static void write(HttpServletResponse response, String text, String contentType) { |
| 29 | - ServletUtil.write(response, text, contentType); | |
| 30 | + JakartaServletUtil.write(response, text, contentType); | |
| 30 | 31 | } |
| 31 | 32 | |
| 32 | 33 | } | ... | ... |
yudao-framework/yudao-common/pom.xml
| ... | ... | @@ -60,7 +60,7 @@ |
| 60 | 60 | |
| 61 | 61 | <dependency> |
| 62 | 62 | <groupId>org.springdoc</groupId> |
| 63 | - <artifactId>springdoc-openapi-ui</artifactId> | |
| 63 | + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> | |
| 64 | 64 | <scope>provided</scope> <!-- 设置为 provided,主要是 PageParam 使用到 --> |
| 65 | 65 | </dependency> |
| 66 | 66 | |
| ... | ... | @@ -127,6 +127,10 @@ |
| 127 | 127 | <groupId>cn.hutool</groupId> |
| 128 | 128 | <artifactId>hutool-all</artifactId> |
| 129 | 129 | </dependency> |
| 130 | + <dependency> | |
| 131 | + <groupId>org.dromara.hutool</groupId> | |
| 132 | + <artifactId>hutool-all</artifactId> | |
| 133 | + </dependency> | |
| 130 | 134 | |
| 131 | 135 | <dependency> |
| 132 | 136 | <groupId>com.alibaba</groupId> | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/pojo/PageParam.java
| ... | ... | @@ -3,9 +3,9 @@ package cn.iocoder.yudao.framework.common.pojo; |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | -import javax.validation.constraints.Min; | |
| 7 | -import javax.validation.constraints.Max; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 6 | +import jakarta.validation.constraints.Min; | |
| 7 | +import jakarta.validation.constraints.Max; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | import java.io.Serializable; |
| 10 | 10 | |
| 11 | 11 | @Schema(description="分页参数") | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/http/HttpUtils.java
| ... | ... | @@ -9,7 +9,7 @@ import org.springframework.util.StringUtils; |
| 9 | 9 | import org.springframework.web.util.UriComponents; |
| 10 | 10 | import org.springframework.web.util.UriComponentsBuilder; |
| 11 | 11 | |
| 12 | -import javax.servlet.http.HttpServletRequest; | |
| 12 | +import jakarta.servlet.http.HttpServletRequest; | |
| 13 | 13 | import java.net.URI; |
| 14 | 14 | import java.nio.charset.Charset; |
| 15 | 15 | import java.util.Map; | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/servlet/ServletUtils.java
| ... | ... | @@ -2,16 +2,16 @@ package cn.iocoder.yudao.framework.common.util.servlet; |
| 2 | 2 | |
| 3 | 3 | import cn.hutool.core.io.IoUtil; |
| 4 | 4 | import cn.hutool.core.util.StrUtil; |
| 5 | -import cn.hutool.extra.servlet.ServletUtil; | |
| 5 | +import cn.hutool.extra.servlet.JakartaServletUtil; | |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.json.JsonUtils; |
| 7 | +import jakarta.servlet.ServletRequest; | |
| 8 | +import jakarta.servlet.http.HttpServletRequest; | |
| 9 | +import jakarta.servlet.http.HttpServletResponse; | |
| 7 | 10 | import org.springframework.http.MediaType; |
| 8 | 11 | import org.springframework.web.context.request.RequestAttributes; |
| 9 | 12 | import org.springframework.web.context.request.RequestContextHolder; |
| 10 | 13 | import org.springframework.web.context.request.ServletRequestAttributes; |
| 11 | 14 | |
| 12 | -import javax.servlet.ServletRequest; | |
| 13 | -import javax.servlet.http.HttpServletRequest; | |
| 14 | -import javax.servlet.http.HttpServletResponse; | |
| 15 | 15 | import java.io.IOException; |
| 16 | 16 | import java.net.URLEncoder; |
| 17 | 17 | import java.util.Map; |
| ... | ... | @@ -32,7 +32,7 @@ public class ServletUtils { |
| 32 | 32 | @SuppressWarnings("deprecation") // 必须使用 APPLICATION_JSON_UTF8_VALUE,否则会乱码 |
| 33 | 33 | public static void writeJSON(HttpServletResponse response, Object object) { |
| 34 | 34 | String content = JsonUtils.toJsonString(object); |
| 35 | - ServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 35 | + JakartaServletUtil.write(response, content, MediaType.APPLICATION_JSON_UTF8_VALUE); | |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | /** |
| ... | ... | @@ -85,7 +85,7 @@ public class ServletUtils { |
| 85 | 85 | if (request == null) { |
| 86 | 86 | return null; |
| 87 | 87 | } |
| 88 | - return ServletUtil.getClientIP(request); | |
| 88 | + return JakartaServletUtil.getClientIP(request); | |
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // TODO @疯狂:terminal 还是从 ServletUtils 里拿,更容易全局治理; |
| ... | ... | @@ -95,19 +95,19 @@ public class ServletUtils { |
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | public static String getBody(HttpServletRequest request) { |
| 98 | - return ServletUtil.getBody(request); | |
| 98 | + return JakartaServletUtil.getBody(request); | |
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public static byte[] getBodyBytes(HttpServletRequest request) { |
| 102 | - return ServletUtil.getBodyBytes(request); | |
| 102 | + return JakartaServletUtil.getBodyBytes(request); | |
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | public static String getClientIP(HttpServletRequest request) { |
| 106 | - return ServletUtil.getClientIP(request); | |
| 106 | + return JakartaServletUtil.getClientIP(request); | |
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | public static Map<String, String> getParamMap(HttpServletRequest request) { |
| 110 | - return ServletUtil.getParamMap(request); | |
| 110 | + return JakartaServletUtil.getParamMap(request); | |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | } | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/validation/ValidationUtils.java
| ... | ... | @@ -4,10 +4,10 @@ import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.lang.Assert; |
| 5 | 5 | import org.springframework.util.StringUtils; |
| 6 | 6 | |
| 7 | -import javax.validation.ConstraintViolation; | |
| 8 | -import javax.validation.ConstraintViolationException; | |
| 9 | -import javax.validation.Validation; | |
| 10 | -import javax.validation.Validator; | |
| 7 | +import jakarta.validation.ConstraintViolation; | |
| 8 | +import jakarta.validation.ConstraintViolationException; | |
| 9 | +import jakarta.validation.Validation; | |
| 10 | +import jakarta.validation.Validator; | |
| 11 | 11 | import java.util.Set; |
| 12 | 12 | import java.util.regex.Pattern; |
| 13 | 13 | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnum.java
| ... | ... | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.common.validation; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 4 | 4 | |
| 5 | -import javax.validation.Constraint; | |
| 6 | -import javax.validation.Payload; | |
| 5 | +import jakarta.validation.Constraint; | |
| 6 | +import jakarta.validation.Payload; | |
| 7 | 7 | import java.lang.annotation.*; |
| 8 | 8 | |
| 9 | 9 | @Target({ | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumCollectionValidator.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 5 | 5 | |
| 6 | -import javax.validation.ConstraintValidator; | |
| 7 | -import javax.validation.ConstraintValidatorContext; | |
| 6 | +import jakarta.validation.ConstraintValidator; | |
| 7 | +import jakarta.validation.ConstraintValidatorContext; | |
| 8 | 8 | import java.util.Arrays; |
| 9 | 9 | import java.util.Collection; |
| 10 | 10 | import java.util.Collections; | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/InEnumValidator.java
| ... | ... | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.common.validation; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.core.IntArrayValuable; |
| 4 | 4 | |
| 5 | -import javax.validation.ConstraintValidator; | |
| 6 | -import javax.validation.ConstraintValidatorContext; | |
| 5 | +import jakarta.validation.ConstraintValidator; | |
| 6 | +import jakarta.validation.ConstraintValidatorContext; | |
| 7 | 7 | import java.util.Arrays; |
| 8 | 8 | import java.util.Collections; |
| 9 | 9 | import java.util.List; | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Mobile.java
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/MobileValidator.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation; |
| 3 | 3 | import cn.hutool.core.util.StrUtil; |
| 4 | 4 | import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 5 | 5 | |
| 6 | -import javax.validation.ConstraintValidator; | |
| 7 | -import javax.validation.ConstraintValidatorContext; | |
| 6 | +import jakarta.validation.ConstraintValidator; | |
| 7 | +import jakarta.validation.ConstraintValidatorContext; | |
| 8 | 8 | |
| 9 | 9 | public class MobileValidator implements ConstraintValidator<Mobile, String> { |
| 10 | 10 | ... | ... |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/Telephone.java
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/validation/TelephoneValidator.java
| ... | ... | @@ -3,8 +3,8 @@ package cn.iocoder.yudao.framework.common.validation; |
| 3 | 3 | import cn.hutool.core.text.CharSequenceUtil; |
| 4 | 4 | import cn.hutool.core.util.PhoneUtil; |
| 5 | 5 | |
| 6 | -import javax.validation.ConstraintValidator; | |
| 7 | -import javax.validation.ConstraintValidatorContext; | |
| 6 | +import jakarta.validation.ConstraintValidator; | |
| 7 | +import jakarta.validation.ConstraintValidatorContext; | |
| 8 | 8 | |
| 9 | 9 | public class TelephoneValidator implements ConstraintValidator<Telephone, String> { |
| 10 | 10 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-error-code/src/main/java/cn/iocoder/yudao/framework/errorcode/config/ErrorCodeProperties.java
| ... | ... | @@ -4,7 +4,7 @@ import lombok.Data; |
| 4 | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | 5 | import org.springframework.validation.annotation.Validated; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotNull; | |
| 8 | 8 | import java.util.List; |
| 9 | 9 | |
| 10 | 10 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-operatelog/src/main/java/cn/iocoder/yudao/framework/operatelog/core/aop/OperateLogAspect.java
| ... | ... | @@ -27,9 +27,9 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 27 | 27 | import org.springframework.web.bind.annotation.RequestMethod; |
| 28 | 28 | import org.springframework.web.multipart.MultipartFile; |
| 29 | 29 | |
| 30 | -import javax.annotation.Resource; | |
| 31 | -import javax.servlet.http.HttpServletRequest; | |
| 32 | -import javax.servlet.http.HttpServletResponse; | |
| 30 | +import jakarta.annotation.Resource; | |
| 31 | +import jakarta.servlet.http.HttpServletRequest; | |
| 32 | +import jakarta.servlet.http.HttpServletResponse; | |
| 33 | 33 | import java.lang.annotation.Annotation; |
| 34 | 34 | import java.lang.reflect.Array; |
| 35 | 35 | import java.time.LocalDateTime; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/PayClientConfig.java
| 1 | 1 | package cn.iocoder.yudao.framework.pay.core.client; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; | |
| 4 | 3 | import com.fasterxml.jackson.annotation.JsonTypeInfo; |
| 5 | 4 | |
| 6 | -import javax.validation.ConstraintViolation; | |
| 7 | -import javax.validation.ConstraintViolationException; | |
| 8 | -import javax.validation.Validator; | |
| 9 | -import java.util.Set; | |
| 5 | +import jakarta.validation.Validator; | |
| 10 | 6 | |
| 11 | 7 | /** |
| 12 | 8 | * 支付客户端的配置,本质是支付渠道的配置 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/order/PayOrderUnifiedReqDTO.java
| ... | ... | @@ -5,9 +5,9 @@ import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.Length; |
| 6 | 6 | import org.hibernate.validator.constraints.URL; |
| 7 | 7 | |
| 8 | -import javax.validation.constraints.DecimalMin; | |
| 9 | -import javax.validation.constraints.NotEmpty; | |
| 10 | -import javax.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.DecimalMin; | |
| 9 | +import jakarta.validation.constraints.NotEmpty; | |
| 10 | +import jakarta.validation.constraints.NotNull; | |
| 11 | 11 | import java.time.LocalDateTime; |
| 12 | 12 | import java.util.Map; |
| 13 | 13 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/refund/PayRefundUnifiedReqDTO.java
| ... | ... | @@ -7,9 +7,9 @@ import lombok.NoArgsConstructor; |
| 7 | 7 | import lombok.experimental.Accessors; |
| 8 | 8 | import org.hibernate.validator.constraints.URL; |
| 9 | 9 | |
| 10 | -import javax.validation.constraints.DecimalMin; | |
| 11 | -import javax.validation.constraints.NotEmpty; | |
| 12 | -import javax.validation.constraints.NotNull; | |
| 10 | +import jakarta.validation.constraints.DecimalMin; | |
| 11 | +import jakarta.validation.constraints.NotEmpty; | |
| 12 | +import jakarta.validation.constraints.NotNull; | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * 统一 退款 Request DTO | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/dto/transfer/PayTransferUnifiedReqDTO.java
| ... | ... | @@ -5,10 +5,10 @@ import cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | import org.hibernate.validator.constraints.Length; |
| 7 | 7 | |
| 8 | -import javax.validation.constraints.Min; | |
| 9 | -import javax.validation.constraints.NotBlank; | |
| 10 | -import javax.validation.constraints.NotEmpty; | |
| 11 | -import javax.validation.constraints.NotNull; | |
| 8 | +import jakarta.validation.constraints.Min; | |
| 9 | +import jakarta.validation.constraints.NotBlank; | |
| 10 | +import jakarta.validation.constraints.NotEmpty; | |
| 11 | +import jakarta.validation.constraints.NotNull; | |
| 12 | 12 | import java.util.Map; |
| 13 | 13 | |
| 14 | 14 | import static cn.iocoder.yudao.framework.pay.core.enums.transfer.PayTransferTypeEnum.*; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/NonePayClientConfig.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.pay.core.client.impl; |
| 3 | 3 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | |
| 6 | -import javax.validation.Validator; | |
| 6 | +import jakarta.validation.Validator; | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * 无需任何配置 PayClientConfig 实现类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AlipayPayClientConfig.java
| ... | ... | @@ -4,11 +4,9 @@ import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 4 | 4 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 5 | 5 | import lombok.Data; |
| 6 | 6 | |
| 7 | -import javax.validation.ConstraintViolation; | |
| 8 | -import javax.validation.Validator; | |
| 9 | -import javax.validation.constraints.NotBlank; | |
| 10 | -import javax.validation.constraints.NotNull; | |
| 11 | -import java.util.Set; | |
| 7 | +import jakarta.validation.Validator; | |
| 8 | +import jakarta.validation.constraints.NotBlank; | |
| 9 | +import jakarta.validation.constraints.NotNull; | |
| 12 | 10 | |
| 13 | 11 | /** |
| 14 | 12 | * 支付宝的 PayClientConfig 实现类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/main/java/cn/iocoder/yudao/framework/pay/core/client/impl/weixin/WxPayClientConfig.java
| ... | ... | @@ -5,8 +5,8 @@ import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 5 | 5 | import cn.iocoder.yudao.framework.pay.core.client.PayClientConfig; |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | |
| 8 | -import javax.validation.Validator; | |
| 9 | -import javax.validation.constraints.NotBlank; | |
| 8 | +import jakarta.validation.Validator; | |
| 9 | +import jakarta.validation.constraints.NotBlank; | |
| 10 | 10 | import java.io.FileInputStream; |
| 11 | 11 | import java.io.FileNotFoundException; |
| 12 | 12 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-pay/src/test/java/cn/iocoder/yudao/framework/pay/core/client/impl/alipay/AbstractAlipayClientTest.java
| ... | ... | @@ -24,7 +24,7 @@ import org.junit.jupiter.api.Test; |
| 24 | 24 | import org.mockito.ArgumentMatcher; |
| 25 | 25 | import org.mockito.Mock; |
| 26 | 26 | |
| 27 | -import javax.validation.ConstraintViolationException; | |
| 27 | +import jakarta.validation.ConstraintViolationException; | |
| 28 | 28 | import java.util.Date; |
| 29 | 29 | |
| 30 | 30 | import static cn.iocoder.yudao.framework.pay.core.client.impl.alipay.AlipayPayClientConfig.MODE_PUBLIC_KEY; | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-sms/src/main/java/cn/iocoder/yudao/framework/sms/core/property/SmsChannelProperties.java
| ... | ... | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.sms.core.enums.SmsChannelEnum; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.springframework.validation.annotation.Validated; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * 短信渠道配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/security/TenantSecurityWebFilter.java
| ... | ... | @@ -15,10 +15,10 @@ import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler; |
| 15 | 15 | import lombok.extern.slf4j.Slf4j; |
| 16 | 16 | import org.springframework.util.AntPathMatcher; |
| 17 | 17 | |
| 18 | -import javax.servlet.FilterChain; | |
| 19 | -import javax.servlet.ServletException; | |
| 20 | -import javax.servlet.http.HttpServletRequest; | |
| 21 | -import javax.servlet.http.HttpServletResponse; | |
| 18 | +import jakarta.servlet.FilterChain; | |
| 19 | +import jakarta.servlet.ServletException; | |
| 20 | +import jakarta.servlet.http.HttpServletRequest; | |
| 21 | +import jakarta.servlet.http.HttpServletResponse; | |
| 22 | 22 | import java.io.IOException; |
| 23 | 23 | import java.util.Objects; |
| 24 | 24 | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/cn/iocoder/yudao/framework/tenant/core/web/TenantContextWebFilter.java
| ... | ... | @@ -4,10 +4,10 @@ import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 4 | 4 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 5 | 5 | import org.springframework.web.filter.OncePerRequestFilter; |
| 6 | 6 | |
| 7 | -import javax.servlet.FilterChain; | |
| 8 | -import javax.servlet.ServletException; | |
| 9 | -import javax.servlet.http.HttpServletRequest; | |
| 10 | -import javax.servlet.http.HttpServletResponse; | |
| 7 | +import jakarta.servlet.FilterChain; | |
| 8 | +import jakarta.servlet.ServletException; | |
| 9 | +import jakarta.servlet.http.HttpServletRequest; | |
| 10 | +import jakarta.servlet.http.HttpServletResponse; | |
| 11 | 11 | import java.io.IOException; |
| 12 | 12 | |
| 13 | 13 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-biz-tenant/src/main/java/org/springframework/messaging/handler/invocation/InvocableHandlerMethod.java
| 1 | 1 | /* |
| 2 | - * Copyright 2002-2021 the original author or authors. | |
| 2 | + * Copyright 2002-2023 the original author or authors. | |
| 3 | 3 | * |
| 4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | 5 | * you may not use this file except in compliance with the License. |
| ... | ... | @@ -16,6 +16,11 @@ |
| 16 | 16 | |
| 17 | 17 | package org.springframework.messaging.handler.invocation; |
| 18 | 18 | |
| 19 | +import java.lang.reflect.InvocationTargetException; | |
| 20 | +import java.lang.reflect.Method; | |
| 21 | +import java.lang.reflect.Type; | |
| 22 | +import java.util.Arrays; | |
| 23 | + | |
| 19 | 24 | import cn.iocoder.yudao.framework.tenant.core.context.TenantContextHolder; |
| 20 | 25 | import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils; |
| 21 | 26 | import org.springframework.core.DefaultParameterNameDiscoverer; |
| ... | ... | @@ -27,11 +32,6 @@ import org.springframework.messaging.Message; |
| 27 | 32 | import org.springframework.messaging.handler.HandlerMethod; |
| 28 | 33 | import org.springframework.util.ObjectUtils; |
| 29 | 34 | |
| 30 | -import java.lang.reflect.InvocationTargetException; | |
| 31 | -import java.lang.reflect.Method; | |
| 32 | -import java.lang.reflect.Type; | |
| 33 | -import java.util.Arrays; | |
| 34 | - | |
| 35 | 35 | import static cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils.HEADER_TENANT_ID; |
| 36 | 36 | |
| 37 | 37 | /** |
| ... | ... | @@ -50,10 +50,12 @@ public class InvocableHandlerMethod extends HandlerMethod { |
| 50 | 50 | |
| 51 | 51 | private static final Object[] EMPTY_ARGS = new Object[0]; |
| 52 | 52 | |
| 53 | + | |
| 53 | 54 | private HandlerMethodArgumentResolverComposite resolvers = new HandlerMethodArgumentResolverComposite(); |
| 54 | 55 | |
| 55 | 56 | private ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer(); |
| 56 | 57 | |
| 58 | + | |
| 57 | 59 | /** |
| 58 | 60 | * Create an instance from a {@code HandlerMethod}. |
| 59 | 61 | */ |
| ... | ... | @@ -81,6 +83,7 @@ public class InvocableHandlerMethod extends HandlerMethod { |
| 81 | 83 | super(bean, methodName, parameterTypes); |
| 82 | 84 | } |
| 83 | 85 | |
| 86 | + | |
| 84 | 87 | /** |
| 85 | 88 | * Set {@link HandlerMethodArgumentResolver HandlerMethodArgumentResolvers} to use for resolving method argument values. |
| 86 | 89 | */ |
| ... | ... | @@ -91,12 +94,13 @@ public class InvocableHandlerMethod extends HandlerMethod { |
| 91 | 94 | /** |
| 92 | 95 | * Set the ParameterNameDiscoverer for resolving parameter names when needed |
| 93 | 96 | * (e.g. default request attribute name). |
| 94 | - * <p>Default is a {@link DefaultParameterNameDiscoverer}. | |
| 97 | + * <p>Default is a {@link org.springframework.core.DefaultParameterNameDiscoverer}. | |
| 95 | 98 | */ |
| 96 | 99 | public void setParameterNameDiscoverer(ParameterNameDiscoverer parameterNameDiscoverer) { |
| 97 | 100 | this.parameterNameDiscoverer = parameterNameDiscoverer; |
| 98 | 101 | } |
| 99 | 102 | |
| 103 | + | |
| 100 | 104 | /** |
| 101 | 105 | * Invoke the method after resolving its argument values in the context of the given message. |
| 102 | 106 | * <p>Argument values are commonly resolved through |
| ... | ... | @@ -200,20 +204,21 @@ public class InvocableHandlerMethod extends HandlerMethod { |
| 200 | 204 | } |
| 201 | 205 | catch (IllegalArgumentException ex) { |
| 202 | 206 | assertTargetBean(getBridgedMethod(), getBean(), args); |
| 203 | - String text = (ex.getMessage() != null ? ex.getMessage() : "Illegal argument"); | |
| 207 | + String text = (ex.getMessage() == null || ex.getCause() instanceof NullPointerException) ? | |
| 208 | + "Illegal argument": ex.getMessage(); | |
| 204 | 209 | throw new IllegalStateException(formatInvokeError(text, args), ex); |
| 205 | 210 | } |
| 206 | 211 | catch (InvocationTargetException ex) { |
| 207 | 212 | // Unwrap for HandlerExceptionResolvers ... |
| 208 | 213 | Throwable targetException = ex.getTargetException(); |
| 209 | - if (targetException instanceof RuntimeException) { | |
| 210 | - throw (RuntimeException) targetException; | |
| 214 | + if (targetException instanceof RuntimeException runtimeException) { | |
| 215 | + throw runtimeException; | |
| 211 | 216 | } |
| 212 | - else if (targetException instanceof Error) { | |
| 213 | - throw (Error) targetException; | |
| 217 | + else if (targetException instanceof Error error) { | |
| 218 | + throw error; | |
| 214 | 219 | } |
| 215 | - else if (targetException instanceof Exception) { | |
| 216 | - throw (Exception) targetException; | |
| 220 | + else if (targetException instanceof Exception exception) { | |
| 221 | + throw exception; | |
| 217 | 222 | } |
| 218 | 223 | else { |
| 219 | 224 | throw new IllegalStateException(formatInvokeError("Invocation failure", args), targetException); |
| ... | ... | @@ -225,7 +230,8 @@ public class InvocableHandlerMethod extends HandlerMethod { |
| 225 | 230 | return new AsyncResultMethodParameter(returnValue); |
| 226 | 231 | } |
| 227 | 232 | |
| 228 | - private class AsyncResultMethodParameter extends HandlerMethodParameter { | |
| 233 | + | |
| 234 | + private class AsyncResultMethodParameter extends AnnotatedMethodParameter { | |
| 229 | 235 | |
| 230 | 236 | @Nullable |
| 231 | 237 | private final Object returnValue; | ... | ... |
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/config/YudaoCaptchaConfiguration.java
| ... | ... | @@ -8,7 +8,7 @@ import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 8 | 8 | import org.springframework.context.annotation.Bean; |
| 9 | 9 | import org.springframework.data.redis.core.StringRedisTemplate; |
| 10 | 10 | |
| 11 | -import javax.annotation.Resource; | |
| 11 | +import jakarta.annotation.Resource; | |
| 12 | 12 | |
| 13 | 13 | @AutoConfiguration |
| 14 | 14 | public class YudaoCaptchaConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-captcha/src/main/java/cn/iocoder/yudao/framework/captcha/core/service/RedisCaptchaServiceImpl.java
| ... | ... | @@ -5,7 +5,7 @@ import lombok.AllArgsConstructor; |
| 5 | 5 | import lombok.NoArgsConstructor; |
| 6 | 6 | import org.springframework.data.redis.core.StringRedisTemplate; |
| 7 | 7 | |
| 8 | -import javax.annotation.Resource; | |
| 8 | +import jakarta.annotation.Resource; | |
| 9 | 9 | import java.util.concurrent.TimeUnit; |
| 10 | 10 | |
| 11 | 11 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-excel/src/main/java/cn/iocoder/yudao/framework/excel/core/util/ExcelUtils.java
| ... | ... | @@ -4,7 +4,7 @@ import com.alibaba.excel.EasyExcel; |
| 4 | 4 | import com.alibaba.excel.write.style.column.LongestMatchColumnWidthStyleStrategy; |
| 5 | 5 | import org.springframework.web.multipart.MultipartFile; |
| 6 | 6 | |
| 7 | -import javax.servlet.http.HttpServletResponse; | |
| 7 | +import jakarta.servlet.http.HttpServletResponse; | |
| 8 | 8 | import java.io.IOException; |
| 9 | 9 | import java.net.URLEncoder; |
| 10 | 10 | import java.util.List; | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/db/DBFileClientConfig.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.URL; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * 基于 DB 存储的文件客户端的配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/ftp/FtpFileClientConfig.java
| ... | ... | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.URL; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Ftp 文件客户端的配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/local/LocalFileClientConfig.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.URL; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * 本地文件客户端的配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientConfig.java
| ... | ... | @@ -6,8 +6,8 @@ import com.fasterxml.jackson.annotation.JsonIgnore; |
| 6 | 6 | import lombok.Data; |
| 7 | 7 | import org.hibernate.validator.constraints.URL; |
| 8 | 8 | |
| 9 | -import javax.validation.constraints.AssertTrue; | |
| 10 | -import javax.validation.constraints.NotNull; | |
| 9 | +import jakarta.validation.constraints.AssertTrue; | |
| 10 | +import jakarta.validation.constraints.NotNull; | |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * S3 文件客户端的配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/main/java/cn/iocoder/yudao/framework/file/core/client/sftp/SftpFileClientConfig.java
| ... | ... | @@ -4,8 +4,8 @@ import cn.iocoder.yudao.framework.file.core.client.FileClientConfig; |
| 4 | 4 | import lombok.Data; |
| 5 | 5 | import org.hibernate.validator.constraints.URL; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * Sftp 文件客户端的配置类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-file/src/test/java/cn/iocoder/yudao/framework/file/core/client/s3/S3FileClientTest.java
| ... | ... | @@ -6,7 +6,7 @@ import cn.iocoder.yudao.framework.common.util.validation.ValidationUtils; |
| 6 | 6 | import org.junit.jupiter.api.Disabled; |
| 7 | 7 | import org.junit.jupiter.api.Test; |
| 8 | 8 | |
| 9 | -import javax.validation.Validation; | |
| 9 | +import jakarta.validation.Validation; | |
| 10 | 10 | |
| 11 | 11 | public class S3FileClientTest { |
| 12 | 12 | ... | ... |
yudao-framework/yudao-spring-boot-starter-flowable/src/main/java/cn/iocoder/yudao/framework/flowable/core/web/FlowableWebFilter.java
| ... | ... | @@ -4,10 +4,10 @@ import cn.iocoder.yudao.framework.flowable.core.util.FlowableUtils; |
| 4 | 4 | import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; |
| 5 | 5 | import org.springframework.web.filter.OncePerRequestFilter; |
| 6 | 6 | |
| 7 | -import javax.servlet.FilterChain; | |
| 8 | -import javax.servlet.ServletException; | |
| 9 | -import javax.servlet.http.HttpServletRequest; | |
| 10 | -import javax.servlet.http.HttpServletResponse; | |
| 7 | +import jakarta.servlet.FilterChain; | |
| 8 | +import jakarta.servlet.ServletException; | |
| 9 | +import jakarta.servlet.http.HttpServletRequest; | |
| 10 | +import jakarta.servlet.http.HttpServletResponse; | |
| 11 | 11 | import java.io.IOException; |
| 12 | 12 | /** |
| 13 | 13 | * flowable Web 过滤器,将 userId 设置到 {@link org.flowable.common.engine.impl.identity.Authentication} 中 | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/handler/JobHandlerInvoker.java
| ... | ... | @@ -13,9 +13,8 @@ import org.quartz.PersistJobDataAfterExecution; |
| 13 | 13 | import org.springframework.context.ApplicationContext; |
| 14 | 14 | import org.springframework.scheduling.quartz.QuartzJobBean; |
| 15 | 15 | |
| 16 | -import javax.annotation.Resource; | |
| 16 | +import jakarta.annotation.Resource; | |
| 17 | 17 | import java.time.LocalDateTime; |
| 18 | -import java.time.temporal.ChronoUnit; | |
| 19 | 18 | |
| 20 | 19 | import static cn.hutool.core.exceptions.ExceptionUtil.getRootCauseMessage; |
| 21 | 20 | ... | ... |
yudao-framework/yudao-spring-boot-starter-job/src/main/java/cn/iocoder/yudao/framework/quartz/core/service/JobLogFrameworkService.java
| 1 | 1 | package cn.iocoder.yudao.framework.quartz.core.service; |
| 2 | 2 | |
| 3 | -import javax.validation.constraints.NotEmpty; | |
| 4 | -import javax.validation.constraints.NotNull; | |
| 3 | +import jakarta.validation.constraints.NotEmpty; | |
| 4 | +import jakarta.validation.constraints.NotNull; | |
| 5 | 5 | import java.time.LocalDateTime; |
| 6 | 6 | |
| 7 | 7 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-monitor/src/main/java/cn/iocoder/yudao/framework/tracer/core/filter/TraceFilter.java
| ... | ... | @@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.tracer.core.filter; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.monitor.TracerUtils; |
| 4 | 4 | import org.springframework.web.filter.OncePerRequestFilter; |
| 5 | 5 | |
| 6 | -import javax.servlet.FilterChain; | |
| 7 | -import javax.servlet.ServletException; | |
| 8 | -import javax.servlet.http.HttpServletRequest; | |
| 9 | -import javax.servlet.http.HttpServletResponse; | |
| 6 | +import jakarta.servlet.FilterChain; | |
| 7 | +import jakarta.servlet.ServletException; | |
| 8 | +import jakarta.servlet.http.HttpServletRequest; | |
| 9 | +import jakarta.servlet.http.HttpServletResponse; | |
| 10 | 10 | import java.io.IOException; |
| 11 | 11 | |
| 12 | 12 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/pom.xml
| ... | ... | @@ -56,21 +56,28 @@ |
| 56 | 56 | |
| 57 | 57 | <dependency> |
| 58 | 58 | <groupId>com.alibaba</groupId> |
| 59 | - <artifactId>druid-spring-boot-starter</artifactId> | |
| 59 | + <artifactId>druid-spring-boot-3-starter</artifactId> | |
| 60 | 60 | </dependency> |
| 61 | 61 | <dependency> |
| 62 | 62 | <groupId>com.baomidou</groupId> |
| 63 | - <artifactId>mybatis-plus-boot-starter</artifactId> | |
| 63 | + <artifactId>mybatis-plus-spring-boot3-starter</artifactId> | |
| 64 | 64 | </dependency> |
| 65 | 65 | <dependency> |
| 66 | 66 | <groupId>com.baomidou</groupId> |
| 67 | - <artifactId>dynamic-datasource-spring-boot-starter</artifactId> <!-- 多数据源 --> | |
| 67 | + <artifactId>dynamic-datasource-spring-boot3-starter</artifactId> <!-- 多数据源 --> | |
| 68 | 68 | </dependency> |
| 69 | 69 | |
| 70 | 70 | <dependency> |
| 71 | 71 | <groupId>com.github.yulichang</groupId> |
| 72 | 72 | <artifactId>mybatis-plus-join-boot-starter</artifactId> <!-- MyBatis 联表查询 --> |
| 73 | 73 | </dependency> |
| 74 | + | |
| 75 | + <!-- TODO 芋艿:临时解决 spring boot 3.x 适配 --> | |
| 76 | + <dependency> | |
| 77 | + <groupId>org.mybatis</groupId> | |
| 78 | + <artifactId>mybatis-spring</artifactId> | |
| 79 | + <version>3.0.3</version> | |
| 80 | + </dependency> | |
| 74 | 81 | </dependencies> |
| 75 | 82 | |
| 76 | 83 | </project> | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/config/YudaoDataSourceAutoConfiguration.java
| 1 | 1 | package cn.iocoder.yudao.framework.datasource.config; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.datasource.core.filter.DruidAdRemoveFilter; |
| 4 | -import com.alibaba.druid.spring.boot.autoconfigure.properties.DruidStatProperties; | |
| 4 | +import com.alibaba.druid.spring.boot3.autoconfigure.properties.DruidStatProperties; | |
| 5 | 5 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 6 | 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| 7 | 7 | import org.springframework.boot.context.properties.EnableConfigurationProperties; | ... | ... |
yudao-framework/yudao-spring-boot-starter-mybatis/src/main/java/cn/iocoder/yudao/framework/datasource/core/filter/DruidAdRemoveFilter.java
| ... | ... | @@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.datasource.core.filter; |
| 3 | 3 | import com.alibaba.druid.util.Utils; |
| 4 | 4 | import org.springframework.web.filter.OncePerRequestFilter; |
| 5 | 5 | |
| 6 | -import javax.servlet.FilterChain; | |
| 7 | -import javax.servlet.ServletException; | |
| 8 | -import javax.servlet.http.HttpServletRequest; | |
| 9 | -import javax.servlet.http.HttpServletResponse; | |
| 6 | +import jakarta.servlet.FilterChain; | |
| 7 | +import jakarta.servlet.ServletException; | |
| 8 | +import jakarta.servlet.http.HttpServletRequest; | |
| 9 | +import jakarta.servlet.http.HttpServletResponse; | |
| 10 | 10 | import java.io.IOException; |
| 11 | 11 | |
| 12 | 12 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-protection/src/main/java/cn/iocoder/yudao/framework/idempotent/core/keyresolver/impl/ExpressionIdempotentKeyResolver.java
| ... | ... | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent; |
| 5 | 5 | import cn.iocoder.yudao.framework.idempotent.core.keyresolver.IdempotentKeyResolver; |
| 6 | 6 | import org.aspectj.lang.JoinPoint; |
| 7 | 7 | import org.aspectj.lang.reflect.MethodSignature; |
| 8 | -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; | |
| 8 | +import org.springframework.core.DefaultParameterNameDiscoverer; | |
| 9 | 9 | import org.springframework.core.ParameterNameDiscoverer; |
| 10 | 10 | import org.springframework.expression.Expression; |
| 11 | 11 | import org.springframework.expression.ExpressionParser; |
| ... | ... | @@ -21,7 +21,8 @@ import java.lang.reflect.Method; |
| 21 | 21 | */ |
| 22 | 22 | public class ExpressionIdempotentKeyResolver implements IdempotentKeyResolver { |
| 23 | 23 | |
| 24 | - private final ParameterNameDiscoverer parameterNameDiscoverer = new LocalVariableTableParameterNameDiscoverer(); | |
| 24 | + private final ParameterNameDiscoverer parameterNameDiscoverer = new DefaultParameterNameDiscoverer(); | |
| 25 | + | |
| 25 | 26 | private final ExpressionParser expressionParser = new SpelExpressionParser(); |
| 26 | 27 | |
| 27 | 28 | @Override | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/AuthorizeRequestsCustomizer.java
| 1 | 1 | package cn.iocoder.yudao.framework.security.config; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.web.config.WebProperties; |
| 4 | +import jakarta.annotation.Resource; | |
| 4 | 5 | import org.springframework.core.Ordered; |
| 5 | 6 | import org.springframework.security.config.Customizer; |
| 6 | 7 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| 7 | -import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; | |
| 8 | - | |
| 9 | -import javax.annotation.Resource; | |
| 8 | +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; | |
| 10 | 9 | |
| 11 | 10 | /** |
| 12 | 11 | * 自定义的 URL 的安全配置 |
| ... | ... | @@ -15,7 +14,7 @@ import javax.annotation.Resource; |
| 15 | 14 | * @author 芋道源码 |
| 16 | 15 | */ |
| 17 | 16 | public abstract class AuthorizeRequestsCustomizer |
| 18 | - implements Customizer<ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry>, Ordered { | |
| 17 | + implements Customizer<AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry>, Ordered { | |
| 19 | 18 | |
| 20 | 19 | @Resource |
| 21 | 20 | private WebProperties webProperties; | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/SecurityProperties.java
| ... | ... | @@ -4,8 +4,8 @@ import lombok.Data; |
| 4 | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | 5 | import org.springframework.validation.annotation.Validated; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | import java.util.Collections; |
| 10 | 10 | import java.util.List; |
| 11 | 11 | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoSecurityAutoConfiguration.java
| ... | ... | @@ -20,7 +20,7 @@ import org.springframework.security.crypto.password.PasswordEncoder; |
| 20 | 20 | import org.springframework.security.web.AuthenticationEntryPoint; |
| 21 | 21 | import org.springframework.security.web.access.AccessDeniedHandler; |
| 22 | 22 | |
| 23 | -import javax.annotation.Resource; | |
| 23 | +import jakarta.annotation.Resource; | |
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Spring Security 自动配置类,主要用于相关组件的配置 | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/config/YudaoWebSecurityConfigurerAdapter.java
| ... | ... | @@ -10,9 +10,13 @@ import org.springframework.context.ApplicationContext; |
| 10 | 10 | import org.springframework.context.annotation.Bean; |
| 11 | 11 | import org.springframework.http.HttpMethod; |
| 12 | 12 | import org.springframework.security.authentication.AuthenticationManager; |
| 13 | +import org.springframework.security.config.Customizer; | |
| 13 | 14 | import org.springframework.security.config.annotation.authentication.configuration.AuthenticationConfiguration; |
| 14 | 15 | import org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity; |
| 16 | +import org.springframework.security.config.annotation.method.configuration.EnableMethodSecurity; | |
| 15 | 17 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| 18 | +import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer; | |
| 19 | +import org.springframework.security.config.annotation.web.configurers.HeadersConfigurer; | |
| 16 | 20 | import org.springframework.security.config.http.SessionCreationPolicy; |
| 17 | 21 | import org.springframework.security.web.AuthenticationEntryPoint; |
| 18 | 22 | import org.springframework.security.web.SecurityFilterChain; |
| ... | ... | @@ -23,8 +27,8 @@ import org.springframework.web.method.HandlerMethod; |
| 23 | 27 | import org.springframework.web.servlet.mvc.method.RequestMappingInfo; |
| 24 | 28 | import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; |
| 25 | 29 | |
| 26 | -import javax.annotation.Resource; | |
| 27 | -import javax.annotation.security.PermitAll; | |
| 30 | +import jakarta.annotation.Resource; | |
| 31 | +import jakarta.annotation.security.PermitAll; | |
| 28 | 32 | import java.util.List; |
| 29 | 33 | import java.util.Map; |
| 30 | 34 | import java.util.Set; |
| ... | ... | @@ -35,7 +39,7 @@ import java.util.Set; |
| 35 | 39 | * @author 芋道源码 |
| 36 | 40 | */ |
| 37 | 41 | @AutoConfiguration |
| 38 | -@EnableGlobalMethodSecurity(prePostEnabled = true, securedEnabled = true) | |
| 42 | +@EnableMethodSecurity(securedEnabled = true) | |
| 39 | 43 | public class YudaoWebSecurityConfigurerAdapter { |
| 40 | 44 | |
| 41 | 45 | @Resource |
| ... | ... | @@ -101,15 +105,15 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 101 | 105 | // 登出 |
| 102 | 106 | httpSecurity |
| 103 | 107 | // 开启跨域 |
| 104 | - .cors().and() | |
| 108 | + .cors(Customizer.withDefaults()) | |
| 105 | 109 | // CSRF 禁用,因为不使用 Session |
| 106 | - .csrf().disable() | |
| 110 | + .csrf(AbstractHttpConfigurer::disable) | |
| 107 | 111 | // 基于 token 机制,所以不需要 Session |
| 108 | - .sessionManagement().sessionCreationPolicy(SessionCreationPolicy.STATELESS).and() | |
| 109 | - .headers().frameOptions().disable().and() | |
| 112 | + .sessionManagement(c -> c.sessionCreationPolicy(SessionCreationPolicy.STATELESS)) | |
| 113 | + .headers(c -> c.frameOptions(HeadersConfigurer.FrameOptionsConfig::disable)) | |
| 110 | 114 | // 一堆自定义的 Spring Security 处理器 |
| 111 | - .exceptionHandling().authenticationEntryPoint(authenticationEntryPoint) | |
| 112 | - .accessDeniedHandler(accessDeniedHandler); | |
| 115 | + .exceptionHandling(c -> c.authenticationEntryPoint(authenticationEntryPoint) | |
| 116 | + .accessDeniedHandler(accessDeniedHandler)); | |
| 113 | 117 | // 登录、登录暂时不使用 Spring Security 的拓展点,主要考虑一方面拓展多用户、多种登录方式相对复杂,一方面用户的学习成本较高 |
| 114 | 118 | |
| 115 | 119 | // 获得 @PermitAll 带来的 URL 列表,免登录 |
| ... | ... | @@ -117,27 +121,25 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 117 | 121 | // 设置每个请求的权限 |
| 118 | 122 | httpSecurity |
| 119 | 123 | // ①:全局共享规则 |
| 120 | - .authorizeRequests() | |
| 121 | - // 1.1 静态资源,可匿名访问 | |
| 122 | - .antMatchers(HttpMethod.GET, "/*.html", "/**/*.html", "/**/*.css", "/**/*.js").permitAll() | |
| 123 | - // 1.2 设置 @PermitAll 无需认证 | |
| 124 | - .antMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll() | |
| 125 | - .antMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll() | |
| 126 | - .antMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll() | |
| 127 | - .antMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll() | |
| 128 | - // 1.3 基于 yudao.security.permit-all-urls 无需认证 | |
| 129 | - .antMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll() | |
| 130 | - // 1.4 设置 App API 无需认证 | |
| 131 | - .antMatchers(buildAppApi("/**")).permitAll() | |
| 132 | - // 1.5 验证码captcha 允许匿名访问 | |
| 133 | - .antMatchers("/captcha/get", "/captcha/check").permitAll() | |
| 124 | + .authorizeHttpRequests(c -> c | |
| 125 | + // 1.1 静态资源,可匿名访问 | |
| 126 | + .requestMatchers(HttpMethod.GET, "/*.html", "/*.html", "/*.css", "/*.js").permitAll() | |
| 127 | + // 1.1 设置 @PermitAll 无需认证 | |
| 128 | + .requestMatchers(HttpMethod.GET, permitAllUrls.get(HttpMethod.GET).toArray(new String[0])).permitAll() | |
| 129 | + .requestMatchers(HttpMethod.POST, permitAllUrls.get(HttpMethod.POST).toArray(new String[0])).permitAll() | |
| 130 | + .requestMatchers(HttpMethod.PUT, permitAllUrls.get(HttpMethod.PUT).toArray(new String[0])).permitAll() | |
| 131 | + .requestMatchers(HttpMethod.DELETE, permitAllUrls.get(HttpMethod.DELETE).toArray(new String[0])).permitAll() | |
| 132 | + .requestMatchers(HttpMethod.HEAD, permitAllUrls.get(HttpMethod.HEAD).toArray(new String[0])).permitAll() | |
| 133 | + .requestMatchers(HttpMethod.PATCH, permitAllUrls.get(HttpMethod.PATCH).toArray(new String[0])).permitAll() | |
| 134 | + // 1.2 基于 yudao.security.permit-all-urls 无需认证 | |
| 135 | + .requestMatchers(securityProperties.getPermitAllUrls().toArray(new String[0])).permitAll() | |
| 136 | + // 1.3 设置 App API 无需认证 | |
| 137 | + .requestMatchers(buildAppApi("/**")).permitAll() | |
| 138 | + ) | |
| 134 | 139 | // ②:每个项目的自定义规则 |
| 135 | - .and().authorizeRequests(registry -> // 下面,循环设置自定义规则 | |
| 136 | - authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(registry))) | |
| 140 | + .authorizeHttpRequests(c -> authorizeRequestsCustomizers.forEach(customizer -> customizer.customize(c))) | |
| 137 | 141 | // ③:兜底规则,必须认证 |
| 138 | - .authorizeRequests() | |
| 139 | - .anyRequest().authenticated() | |
| 140 | - ; | |
| 142 | + .authorizeHttpRequests(c -> c.anyRequest().authenticated()); | |
| 141 | 143 | |
| 142 | 144 | // 添加 Token Filter |
| 143 | 145 | httpSecurity.addFilterBefore(authenticationTokenFilter, UsernamePasswordAuthenticationFilter.class); |
| ... | ... | @@ -171,6 +173,8 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 171 | 173 | result.putAll(HttpMethod.POST, urls); |
| 172 | 174 | result.putAll(HttpMethod.PUT, urls); |
| 173 | 175 | result.putAll(HttpMethod.DELETE, urls); |
| 176 | + result.putAll(HttpMethod.HEAD, urls); | |
| 177 | + result.putAll(HttpMethod.PATCH, urls); | |
| 174 | 178 | continue; |
| 175 | 179 | } |
| 176 | 180 | // 根据请求方法,添加到 result 结果 |
| ... | ... | @@ -188,6 +192,12 @@ public class YudaoWebSecurityConfigurerAdapter { |
| 188 | 192 | case DELETE: |
| 189 | 193 | result.putAll(HttpMethod.DELETE, urls); |
| 190 | 194 | break; |
| 195 | + case HEAD: | |
| 196 | + result.putAll(HttpMethod.HEAD, urls); | |
| 197 | + break; | |
| 198 | + case PATCH: | |
| 199 | + result.putAll(HttpMethod.PATCH, urls); | |
| 200 | + break; | |
| 191 | 201 | } |
| 192 | 202 | }); |
| 193 | 203 | } | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/filter/TokenAuthenticationFilter.java
| ... | ... | @@ -16,10 +16,10 @@ import lombok.RequiredArgsConstructor; |
| 16 | 16 | import org.springframework.security.access.AccessDeniedException; |
| 17 | 17 | import org.springframework.web.filter.OncePerRequestFilter; |
| 18 | 18 | |
| 19 | -import javax.servlet.FilterChain; | |
| 20 | -import javax.servlet.ServletException; | |
| 21 | -import javax.servlet.http.HttpServletRequest; | |
| 22 | -import javax.servlet.http.HttpServletResponse; | |
| 19 | +import jakarta.servlet.FilterChain; | |
| 20 | +import jakarta.servlet.ServletException; | |
| 21 | +import jakarta.servlet.http.HttpServletRequest; | |
| 22 | +import jakarta.servlet.http.HttpServletResponse; | |
| 23 | 23 | import java.io.IOException; |
| 24 | 24 | |
| 25 | 25 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AccessDeniedHandlerImpl.java
| ... | ... | @@ -8,16 +8,14 @@ import lombok.extern.slf4j.Slf4j; |
| 8 | 8 | import org.springframework.security.access.AccessDeniedException; |
| 9 | 9 | import org.springframework.security.web.access.AccessDeniedHandler; |
| 10 | 10 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 11 | -import org.springframework.stereotype.Component; | |
| 12 | 11 | |
| 13 | -import javax.servlet.FilterChain; | |
| 14 | -import javax.servlet.ServletException; | |
| 15 | -import javax.servlet.http.HttpServletRequest; | |
| 16 | -import javax.servlet.http.HttpServletResponse; | |
| 12 | +import jakarta.servlet.FilterChain; | |
| 13 | +import jakarta.servlet.ServletException; | |
| 14 | +import jakarta.servlet.http.HttpServletRequest; | |
| 15 | +import jakarta.servlet.http.HttpServletResponse; | |
| 17 | 16 | import java.io.IOException; |
| 18 | 17 | |
| 19 | 18 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.FORBIDDEN; |
| 20 | -import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; | |
| 21 | 19 | |
| 22 | 20 | /** |
| 23 | 21 | * 访问一个需要认证的 URL 资源,已经认证(登录)但是没有权限的情况下,返回 {@link GlobalErrorCodeConstants#FORBIDDEN} 错误码。 | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/handler/AuthenticationEntryPointImpl.java
| ... | ... | @@ -8,9 +8,9 @@ import org.springframework.security.core.AuthenticationException; |
| 8 | 8 | import org.springframework.security.web.AuthenticationEntryPoint; |
| 9 | 9 | import org.springframework.security.web.access.ExceptionTranslationFilter; |
| 10 | 10 | |
| 11 | -import javax.servlet.FilterChain; | |
| 12 | -import javax.servlet.http.HttpServletRequest; | |
| 13 | -import javax.servlet.http.HttpServletResponse; | |
| 11 | +import jakarta.servlet.FilterChain; | |
| 12 | +import jakarta.servlet.http.HttpServletRequest; | |
| 13 | +import jakarta.servlet.http.HttpServletResponse; | |
| 14 | 14 | |
| 15 | 15 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.UNAUTHORIZED; |
| 16 | 16 | ... | ... |
yudao-framework/yudao-spring-boot-starter-security/src/main/java/cn/iocoder/yudao/framework/security/core/util/SecurityFrameworkUtils.java
| ... | ... | @@ -11,7 +11,7 @@ import org.springframework.security.core.context.SecurityContextHolder; |
| 11 | 11 | import org.springframework.security.web.authentication.WebAuthenticationDetailsSource; |
| 12 | 12 | import org.springframework.util.StringUtils; |
| 13 | 13 | |
| 14 | -import javax.servlet.http.HttpServletRequest; | |
| 14 | +import jakarta.servlet.http.HttpServletRequest; | |
| 15 | 15 | import java.util.Collections; |
| 16 | 16 | |
| 17 | 17 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbAndRedisUnitTest.java
| ... | ... | @@ -5,9 +5,10 @@ import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; |
| 5 | 5 | import cn.iocoder.yudao.framework.redis.config.YudaoRedisAutoConfiguration; |
| 6 | 6 | import cn.iocoder.yudao.framework.test.config.RedisTestConfiguration; |
| 7 | 7 | import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration; |
| 8 | -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; | |
| 8 | +import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure; | |
| 9 | 9 | import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; |
| 10 | 10 | import org.redisson.spring.starter.RedissonAutoConfiguration; |
| 11 | +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; | |
| 11 | 12 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; |
| 12 | 13 | import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration; |
| 13 | 14 | import org.springframework.boot.test.context.SpringBootTest; |
| ... | ... | @@ -40,8 +41,8 @@ public class BaseDbAndRedisUnitTest { |
| 40 | 41 | |
| 41 | 42 | // Redis 配置类 |
| 42 | 43 | RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer |
| 43 | -// RedisAutoConfiguration.class, // Spring Redis 自动配置类 | |
| 44 | 44 | YudaoRedisAutoConfiguration.class, // 自己的 Redis 配置类 |
| 45 | + RedisAutoConfiguration.class, // Spring Redis 自动配置类 | |
| 45 | 46 | RedissonAutoConfiguration.class, // Redisson 自动高配置类 |
| 46 | 47 | }) |
| 47 | 48 | public static class Application { | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/ut/BaseDbUnitTest.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.test.core.ut; |
| 3 | 3 | import cn.iocoder.yudao.framework.datasource.config.YudaoDataSourceAutoConfiguration; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.config.YudaoMybatisAutoConfiguration; |
| 5 | 5 | import cn.iocoder.yudao.framework.test.config.SqlInitializationTestConfiguration; |
| 6 | -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; | |
| 6 | +import com.alibaba.druid.spring.boot3.autoconfigure.DruidDataSourceAutoConfigure; | |
| 7 | 7 | import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; |
| 8 | 8 | import com.github.yulichang.autoconfigure.MybatisPlusJoinAutoConfiguration; |
| 9 | 9 | import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; | ... | ... |
yudao-framework/yudao-spring-boot-starter-test/src/main/java/cn/iocoder/yudao/framework/test/core/util/RandomUtils.java
| ... | ... | @@ -7,10 +7,7 @@ import cn.hutool.core.util.StrUtil; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; |
| 8 | 8 | import uk.co.jemos.podam.api.PodamFactory; |
| 9 | 9 | import uk.co.jemos.podam.api.PodamFactoryImpl; |
| 10 | -import uk.co.jemos.podam.common.AttributeStrategy; | |
| 11 | 10 | |
| 12 | -import javax.validation.constraints.Email; | |
| 13 | -import java.lang.annotation.Annotation; | |
| 14 | 11 | import java.lang.reflect.Type; |
| 15 | 12 | import java.time.LocalDateTime; |
| 16 | 13 | import java.util.Arrays; | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/pom.xml
| ... | ... | @@ -35,11 +35,11 @@ |
| 35 | 35 | |
| 36 | 36 | <dependency> |
| 37 | 37 | <groupId>com.github.xiaoymin</groupId> |
| 38 | - <artifactId>knife4j-openapi3-spring-boot-starter</artifactId> | |
| 38 | + <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> | |
| 39 | 39 | </dependency> |
| 40 | 40 | <dependency> |
| 41 | 41 | <groupId>org.springdoc</groupId> |
| 42 | - <artifactId>springdoc-openapi-ui</artifactId> | |
| 42 | + <artifactId>springdoc-openapi-starter-webmvc-api</artifactId> | |
| 43 | 43 | </dependency> |
| 44 | 44 | |
| 45 | 45 | <dependency> | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/config/YudaoApiLogAutoConfiguration.java
| ... | ... | @@ -16,7 +16,7 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; |
| 16 | 16 | import org.springframework.boot.web.servlet.FilterRegistrationBean; |
| 17 | 17 | import org.springframework.context.annotation.Bean; |
| 18 | 18 | |
| 19 | -import javax.servlet.Filter; | |
| 19 | +import jakarta.servlet.Filter; | |
| 20 | 20 | |
| 21 | 21 | @AutoConfiguration(after = YudaoWebAutoConfiguration.class) |
| 22 | 22 | public class YudaoApiLogAutoConfiguration { | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/filter/ApiAccessLogFilter.java
| ... | ... | @@ -14,10 +14,10 @@ import cn.iocoder.yudao.framework.web.core.filter.ApiRequestFilter; |
| 14 | 14 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 15 | 15 | import lombok.extern.slf4j.Slf4j; |
| 16 | 16 | |
| 17 | -import javax.servlet.FilterChain; | |
| 18 | -import javax.servlet.ServletException; | |
| 19 | -import javax.servlet.http.HttpServletRequest; | |
| 20 | -import javax.servlet.http.HttpServletResponse; | |
| 17 | +import jakarta.servlet.FilterChain; | |
| 18 | +import jakarta.servlet.ServletException; | |
| 19 | +import jakarta.servlet.http.HttpServletRequest; | |
| 20 | +import jakarta.servlet.http.HttpServletResponse; | |
| 21 | 21 | import java.io.IOException; |
| 22 | 22 | import java.time.LocalDateTime; |
| 23 | 23 | import java.time.temporal.ChronoUnit; | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiAccessLog.java
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/apilog/core/service/ApiErrorLog.java
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/SwaggerProperties.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.framework.swagger.config; |
| 3 | 3 | import lombok.Data; |
| 4 | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | 5 | |
| 6 | -import javax.validation.constraints.NotEmpty; | |
| 6 | +import jakarta.validation.constraints.NotEmpty; | |
| 7 | 7 | |
| 8 | 8 | /** |
| 9 | 9 | * Swagger 配置属性 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| ... | ... | @@ -10,10 +10,14 @@ import io.swagger.v3.oas.models.media.StringSchema; |
| 10 | 10 | import io.swagger.v3.oas.models.parameters.Parameter; |
| 11 | 11 | import io.swagger.v3.oas.models.security.SecurityRequirement; |
| 12 | 12 | import io.swagger.v3.oas.models.security.SecurityScheme; |
| 13 | -import org.springdoc.core.*; | |
| 14 | 13 | import org.springdoc.core.customizers.OpenApiBuilderCustomizer; |
| 15 | 14 | import org.springdoc.core.customizers.ServerBaseUrlCustomizer; |
| 15 | +import org.springdoc.core.models.GroupedOpenApi; | |
| 16 | +import org.springdoc.core.properties.SpringDocConfigProperties; | |
| 16 | 17 | import org.springdoc.core.providers.JavadocProvider; |
| 18 | +import org.springdoc.core.service.OpenAPIService; | |
| 19 | +import org.springdoc.core.service.SecurityService; | |
| 20 | +import org.springdoc.core.utils.PropertyResolverUtils; | |
| 17 | 21 | import org.springframework.boot.autoconfigure.AutoConfiguration; |
| 18 | 22 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 19 | 23 | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/WebProperties.java
| ... | ... | @@ -7,9 +7,9 @@ import org.springframework.boot.context.properties.ConfigurationProperties; |
| 7 | 7 | import org.springframework.validation.annotation.Validated; |
| 8 | 8 | import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; |
| 9 | 9 | |
| 10 | -import javax.validation.Valid; | |
| 11 | -import javax.validation.constraints.NotEmpty; | |
| 12 | -import javax.validation.constraints.NotNull; | |
| 10 | +import jakarta.validation.Valid; | |
| 11 | +import jakarta.validation.constraints.NotEmpty; | |
| 12 | +import jakarta.validation.constraints.NotNull; | |
| 13 | 13 | |
| 14 | 14 | @ConfigurationProperties(prefix = "yudao.web") |
| 15 | 15 | @Validated | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/config/YudaoWebAutoConfiguration.java
| ... | ... | @@ -24,8 +24,8 @@ import org.springframework.web.filter.CorsFilter; |
| 24 | 24 | import org.springframework.web.servlet.config.annotation.PathMatchConfigurer; |
| 25 | 25 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| 26 | 26 | |
| 27 | -import javax.annotation.Resource; | |
| 28 | -import javax.servlet.Filter; | |
| 27 | +import jakarta.annotation.Resource; | |
| 28 | +import jakarta.servlet.Filter; | |
| 29 | 29 | |
| 30 | 30 | @AutoConfiguration |
| 31 | 31 | @EnableConfigurationProperties(WebProperties.class) | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/ApiRequestFilter.java
| ... | ... | @@ -5,7 +5,7 @@ import cn.iocoder.yudao.framework.web.config.WebProperties; |
| 5 | 5 | import lombok.RequiredArgsConstructor; |
| 6 | 6 | import org.springframework.web.filter.OncePerRequestFilter; |
| 7 | 7 | |
| 8 | -import javax.servlet.http.HttpServletRequest; | |
| 8 | +import jakarta.servlet.http.HttpServletRequest; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * 过滤 /admin-api、/app-api 等 API 请求的过滤器 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyFilter.java
| ... | ... | @@ -3,10 +3,10 @@ package cn.iocoder.yudao.framework.web.core.filter; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 4 | 4 | import org.springframework.web.filter.OncePerRequestFilter; |
| 5 | 5 | |
| 6 | -import javax.servlet.FilterChain; | |
| 7 | -import javax.servlet.ServletException; | |
| 8 | -import javax.servlet.http.HttpServletRequest; | |
| 9 | -import javax.servlet.http.HttpServletResponse; | |
| 6 | +import jakarta.servlet.FilterChain; | |
| 7 | +import jakarta.servlet.ServletException; | |
| 8 | +import jakarta.servlet.http.HttpServletRequest; | |
| 9 | +import jakarta.servlet.http.HttpServletResponse; | |
| 10 | 10 | import java.io.IOException; |
| 11 | 11 | |
| 12 | 12 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/CacheRequestBodyWrapper.java
| ... | ... | @@ -2,10 +2,10 @@ package cn.iocoder.yudao.framework.web.core.filter; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 4 | 4 | |
| 5 | -import javax.servlet.ReadListener; | |
| 6 | -import javax.servlet.ServletInputStream; | |
| 7 | -import javax.servlet.http.HttpServletRequest; | |
| 8 | -import javax.servlet.http.HttpServletRequestWrapper; | |
| 5 | +import jakarta.servlet.ReadListener; | |
| 6 | +import jakarta.servlet.ServletInputStream; | |
| 7 | +import jakarta.servlet.http.HttpServletRequest; | |
| 8 | +import jakarta.servlet.http.HttpServletRequestWrapper; | |
| 9 | 9 | import java.io.BufferedReader; |
| 10 | 10 | import java.io.ByteArrayInputStream; |
| 11 | 11 | import java.io.IOException; | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/filter/DemoFilter.java
| ... | ... | @@ -6,9 +6,9 @@ import cn.iocoder.yudao.framework.common.util.servlet.ServletUtils; |
| 6 | 6 | import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils; |
| 7 | 7 | import org.springframework.web.filter.OncePerRequestFilter; |
| 8 | 8 | |
| 9 | -import javax.servlet.FilterChain; | |
| 10 | -import javax.servlet.http.HttpServletRequest; | |
| 11 | -import javax.servlet.http.HttpServletResponse; | |
| 9 | +import jakarta.servlet.FilterChain; | |
| 10 | +import jakarta.servlet.http.HttpServletRequest; | |
| 11 | +import jakarta.servlet.http.HttpServletResponse; | |
| 12 | 12 | |
| 13 | 13 | import static cn.iocoder.yudao.framework.common.exception.enums.GlobalErrorCodeConstants.DEMO_DENY; |
| 14 | 14 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/handler/GlobalExceptionHandler.java
| ... | ... | @@ -26,10 +26,10 @@ import org.springframework.web.bind.annotation.RestControllerAdvice; |
| 26 | 26 | import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException; |
| 27 | 27 | import org.springframework.web.servlet.NoHandlerFoundException; |
| 28 | 28 | |
| 29 | -import javax.servlet.http.HttpServletRequest; | |
| 30 | -import javax.validation.ConstraintViolation; | |
| 31 | -import javax.validation.ConstraintViolationException; | |
| 32 | -import javax.validation.ValidationException; | |
| 29 | +import jakarta.servlet.http.HttpServletRequest; | |
| 30 | +import jakarta.validation.ConstraintViolation; | |
| 31 | +import jakarta.validation.ConstraintViolationException; | |
| 32 | +import jakarta.validation.ValidationException; | |
| 33 | 33 | import java.time.LocalDateTime; |
| 34 | 34 | import java.util.Map; |
| 35 | 35 | import java.util.Objects; | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/web/core/util/WebFrameworkUtils.java
| ... | ... | @@ -8,8 +8,8 @@ import org.springframework.web.context.request.RequestAttributes; |
| 8 | 8 | import org.springframework.web.context.request.RequestContextHolder; |
| 9 | 9 | import org.springframework.web.context.request.ServletRequestAttributes; |
| 10 | 10 | |
| 11 | -import javax.servlet.ServletRequest; | |
| 12 | -import javax.servlet.http.HttpServletRequest; | |
| 11 | +import jakarta.servlet.ServletRequest; | |
| 12 | +import jakarta.servlet.http.HttpServletRequest; | |
| 13 | 13 | |
| 14 | 14 | /** |
| 15 | 15 | * 专属于 web 包的工具类 | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssFilter.java
| ... | ... | @@ -6,10 +6,10 @@ import lombok.AllArgsConstructor; |
| 6 | 6 | import org.springframework.util.PathMatcher; |
| 7 | 7 | import org.springframework.web.filter.OncePerRequestFilter; |
| 8 | 8 | |
| 9 | -import javax.servlet.FilterChain; | |
| 10 | -import javax.servlet.ServletException; | |
| 11 | -import javax.servlet.http.HttpServletRequest; | |
| 12 | -import javax.servlet.http.HttpServletResponse; | |
| 9 | +import jakarta.servlet.FilterChain; | |
| 10 | +import jakarta.servlet.ServletException; | |
| 11 | +import jakarta.servlet.http.HttpServletRequest; | |
| 12 | +import jakarta.servlet.http.HttpServletResponse; | |
| 13 | 13 | import java.io.IOException; |
| 14 | 14 | |
| 15 | 15 | /** | ... | ... |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/xss/core/filter/XssRequestWrapper.java
| ... | ... | @@ -2,8 +2,8 @@ package cn.iocoder.yudao.framework.xss.core.filter; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.xss.core.clean.XssCleaner; |
| 4 | 4 | |
| 5 | -import javax.servlet.http.HttpServletRequest; | |
| 6 | -import javax.servlet.http.HttpServletRequestWrapper; | |
| 5 | +import jakarta.servlet.http.HttpServletRequest; | |
| 6 | +import jakarta.servlet.http.HttpServletRequestWrapper; | |
| 7 | 7 | import java.util.LinkedHashMap; |
| 8 | 8 | import java.util.Map; |
| 9 | 9 | ... | ... |
yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/config/WebSocketProperties.java
| ... | ... | @@ -4,8 +4,8 @@ import lombok.Data; |
| 4 | 4 | import org.springframework.boot.context.properties.ConfigurationProperties; |
| 5 | 5 | import org.springframework.validation.annotation.Validated; |
| 6 | 6 | |
| 7 | -import javax.validation.constraints.NotEmpty; | |
| 8 | -import javax.validation.constraints.NotNull; | |
| 7 | +import jakarta.validation.constraints.NotEmpty; | |
| 8 | +import jakarta.validation.constraints.NotNull; | |
| 9 | 9 | |
| 10 | 10 | /** |
| 11 | 11 | * WebSocket 配置项 | ... | ... |
yudao-framework/yudao-spring-boot-starter-websocket/src/main/java/cn/iocoder/yudao/framework/websocket/core/security/WebSocketAuthorizeRequestsCustomizer.java
| ... | ... | @@ -4,7 +4,7 @@ import cn.iocoder.yudao.framework.security.config.AuthorizeRequestsCustomizer; |
| 4 | 4 | import cn.iocoder.yudao.framework.websocket.config.WebSocketProperties; |
| 5 | 5 | import lombok.RequiredArgsConstructor; |
| 6 | 6 | import org.springframework.security.config.annotation.web.builders.HttpSecurity; |
| 7 | -import org.springframework.security.config.annotation.web.configurers.ExpressionUrlAuthorizationConfigurer; | |
| 7 | +import org.springframework.security.config.annotation.web.configurers.AuthorizeHttpRequestsConfigurer; | |
| 8 | 8 | |
| 9 | 9 | /** |
| 10 | 10 | * WebSocket 的权限自定义 |
| ... | ... | @@ -17,8 +17,8 @@ public class WebSocketAuthorizeRequestsCustomizer extends AuthorizeRequestsCusto |
| 17 | 17 | private final WebSocketProperties webSocketProperties; |
| 18 | 18 | |
| 19 | 19 | @Override |
| 20 | - public void customize(ExpressionUrlAuthorizationConfigurer<HttpSecurity>.ExpressionInterceptUrlRegistry registry) { | |
| 21 | - registry.antMatchers(webSocketProperties.getPath()).permitAll(); | |
| 20 | + public void customize(AuthorizeHttpRequestsConfigurer<HttpSecurity>.AuthorizationManagerRequestMatcherRegistry registry) { | |
| 21 | + registry.requestMatchers(webSocketProperties.getPath()).permitAll(); | |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | } | ... | ... |
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApi.java
yudao-module-bpm/yudao-module-bpm-api/src/main/java/cn/iocoder/yudao/module/bpm/api/task/dto/BpmProcessInstanceCreateReqDTO.java
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/api/task/BpmProcessInstanceApiImpl.java
| ... | ... | @@ -5,8 +5,8 @@ import cn.iocoder.yudao.module.bpm.service.task.BpmProcessInstanceService; |
| 5 | 5 | import org.springframework.stereotype.Service; |
| 6 | 6 | import org.springframework.validation.annotation.Validated; |
| 7 | 7 | |
| 8 | -import javax.annotation.Resource; | |
| 9 | -import javax.validation.Valid; | |
| 8 | +import jakarta.annotation.Resource; | |
| 9 | +import jakarta.validation.Valid; | |
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * Flowable 流程实例 Api 实现类 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmFormController.java
| ... | ... | @@ -13,8 +13,8 @@ import org.springframework.security.access.prepost.PreAuthorize; |
| 13 | 13 | import org.springframework.validation.annotation.Validated; |
| 14 | 14 | import org.springframework.web.bind.annotation.*; |
| 15 | 15 | |
| 16 | -import javax.annotation.Resource; | |
| 17 | -import javax.validation.Valid; | |
| 16 | +import jakarta.annotation.Resource; | |
| 17 | +import jakarta.validation.Valid; | |
| 18 | 18 | import java.util.List; |
| 19 | 19 | |
| 20 | 20 | import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmModelController.java
| ... | ... | @@ -13,8 +13,8 @@ import org.springframework.security.access.prepost.PreAuthorize; |
| 13 | 13 | import org.springframework.validation.annotation.Validated; |
| 14 | 14 | import org.springframework.web.bind.annotation.*; |
| 15 | 15 | |
| 16 | -import javax.annotation.Resource; | |
| 17 | -import javax.validation.Valid; | |
| 16 | +import jakarta.annotation.Resource; | |
| 17 | +import jakarta.validation.Valid; | |
| 18 | 18 | |
| 19 | 19 | import java.io.IOException; |
| 20 | 20 | ... | ... |
yudao-module-bpm/yudao-module-bpm-biz/src/main/java/cn/iocoder/yudao/module/bpm/controller/admin/definition/BpmProcessDefinitionController.java
| ... | ... | @@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RequestMapping; |
| 17 | 17 | import org.springframework.web.bind.annotation.RequestParam; |
| 18 | 18 | import org.springframework.web.bind.annotation.RestController; |
| 19 | 19 | |
| 20 | -import javax.annotation.Resource; | |
| 20 | +import jakarta.annotation.Resource; | |
| 21 | 21 | |
| 22 | 22 | import java.util.List; |
| 23 | 23 | ... | ... |