Commit 6fd14b30c2dd9937b9c331982662ee382b8a1787
1 parent
b9f1eacf
1. 升级 spring boot 到 2.6.8
2. 修复 Spring Fox 在 2.6.X 版本的兼容性
Showing
9 changed files
with
90 additions
and
29 deletions
README.md
| @@ -157,27 +157,27 @@ ps:核心功能已经实现,正在对接微信小程序中... | @@ -157,27 +157,27 @@ ps:核心功能已经实现,正在对接微信小程序中... | ||
| 157 | 157 | ||
| 158 | | 框架 | 说明 | 版本 | 学习指南 | | 158 | | 框架 | 说明 | 版本 | 学习指南 | |
| 159 | |---------------------------------------------------------------------------------------------|------------------|----------|----------------------------------------------------------------| | 159 | |---------------------------------------------------------------------------------------------|------------------|----------|----------------------------------------------------------------| |
| 160 | -| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.5.12 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | | 160 | +| [Spring Boot](https://spring.io/projects/spring-boot) | 应用开发框架 | 2.6.8 | [文档](https://github.com/YunaiV/SpringBoot-Labs) | |
| 161 | | [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 | | | 161 | | [MySQL](https://www.mysql.com/cn/) | 数据库服务器 | 5.7 | | |
| 162 | | [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | 162 | | [Druid](https://github.com/alibaba/druid) | JDBC 连接池、监控组件 | 1.2.8 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | |
| 163 | | [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.1 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | | 163 | | [MyBatis Plus](https://mp.baomidou.com/) | MyBatis 增强工具包 | 3.5.1 | [文档](http://www.iocoder.cn/Spring-Boot/MyBatis/?yudao) | |
| 164 | | [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | | 164 | | [Dynamic Datasource](https://dynamic-datasource.com/) | 动态数据源 | 3.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/datasource-pool/?yudao) | |
| 165 | | [Redis](https://redis.io/) | key-value 数据库 | 5.0 | | | 165 | | [Redis](https://redis.io/) | key-value 数据库 | 5.0 | | |
| 166 | -| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.16.8 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | | ||
| 167 | -| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.16 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | ||
| 168 | -| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.5.5 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | ||
| 169 | -| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.2 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | 166 | +| [Redisson](https://github.com/redisson/redisson) | Redis 客户端 | 3.17.3 | [文档](http://www.iocoder.cn/Spring-Boot/Redis/?yudao) | |
| 167 | +| [Spring MVC](https://github.com/spring-projects/spring-framework/tree/master/spring-webmvc) | MVC 框架 | 5.3.20 | [文档](http://www.iocoder.cn/SpringMVC/MVC/?yudao) | | ||
| 168 | +| [Spring Security](https://github.com/spring-projects/spring-security) | Spring 安全框架 | 5.6.5 | [文档](http://www.iocoder.cn/Spring-Boot/Spring-Security/?yudao) | | ||
| 169 | +| [Hibernate Validator](https://github.com/hibernate/hibernate-validator) | 参数校验组件 | 6.2.3 | [文档](http://www.iocoder.cn/Spring-Boot/Validation/?yudao) | | ||
| 170 | | [Activiti](https://github.com/Activiti/Activiti) | 工作流引擎 | 7.1.0.M6 | [文档](TODO) | | 170 | | [Activiti](https://github.com/Activiti/Activiti) | 工作流引擎 | 7.1.0.M6 | [文档](TODO) | |
| 171 | | [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) | | 171 | | [Quartz](https://github.com/quartz-scheduler) | 任务调度组件 | 2.3.2 | [文档](http://www.iocoder.cn/Spring-Boot/Job/?yudao) | |
| 172 | -| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.2 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | | ||
| 173 | -| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.0 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | 172 | +| [Knife4j](https://gitee.com/xiaoym/knife4j) | Swagger 增强 UI 实现 | 3.0.3 | [文档](http://www.iocoder.cn/Spring-Boot/Swagger/?yudao) | |
| 173 | +| [Resilience4j](https://github.com/resilience4j/resilience4j) | 服务保障组件 | 1.7.1 | [文档](http://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao) | | ||
| 174 | | [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | | 174 | | [SkyWalking](https://skywalking.apache.org/) | 分布式应用追踪系统 | 8.5.0 | [文档](http://www.iocoder.cn/Spring-Boot/SkyWalking/?yudao) | |
| 175 | -| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.4.2 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | | ||
| 176 | -| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.12.6 | | | 175 | +| [Spring Boot Admin](https://github.com/codecentric/spring-boot-admin) | Spring Boot 监控平台 | 2.6.7 | [文档](http://www.iocoder.cn/Spring-Boot/Admin/?yudao) | |
| 176 | +| [Jackson](https://github.com/FasterXML/jackson) | JSON 工具库 | 2.13.3 | | | ||
| 177 | | [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | | 177 | | [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | |
| 178 | | [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | | 178 | | [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | |
| 179 | -| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.7.2 | - | | ||
| 180 | -| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 3.9.0 | - | | 179 | +| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.8.2 | - | |
| 180 | +| [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 4.0.0 | - | | ||
| 181 | 181 | ||
| 182 | ### 前端 | 182 | ### 前端 |
| 183 | 183 |
http-client.env.json
| @@ -7,5 +7,14 @@ | @@ -7,5 +7,14 @@ | ||
| 7 | "appApi": "http://127.0.0.1:48080/app-api", | 7 | "appApi": "http://127.0.0.1:48080/app-api", |
| 8 | "appToken": "test1", | 8 | "appToken": "test1", |
| 9 | "appTenentId": "1" | 9 | "appTenentId": "1" |
| 10 | + }, | ||
| 11 | + "gateway": { | ||
| 12 | + "baseUrl": "http://127.0.0.1:8888/admin-api", | ||
| 13 | + "token": "test1", | ||
| 14 | + "adminTenentId": "1", | ||
| 15 | + | ||
| 16 | + "appApi": "http://127.0.0.1:8888/app-api", | ||
| 17 | + "appToken": "test1", | ||
| 18 | + "appTenentId": "1" | ||
| 10 | } | 19 | } |
| 11 | } | 20 | } |
yudao-dependencies/pom.xml
| @@ -16,31 +16,31 @@ | @@ -16,31 +16,31 @@ | ||
| 16 | <properties> | 16 | <properties> |
| 17 | <revision>1.6.2-snapshot</revision> | 17 | <revision>1.6.2-snapshot</revision> |
| 18 | <!-- 统一依赖管理 --> | 18 | <!-- 统一依赖管理 --> |
| 19 | - <spring.boot.version>2.5.12</spring.boot.version> | 19 | + <spring.boot.version>2.6.8</spring.boot.version> |
| 20 | <!-- Web 相关 --> | 20 | <!-- Web 相关 --> |
| 21 | - <knife4j.version>3.0.2</knife4j.version> | ||
| 22 | - <swagger-annotations.version>1.5.22</swagger-annotations.version> | 21 | + <knife4j.version>3.0.3</knife4j.version> |
| 22 | + <swagger-annotations.version>1.6.6</swagger-annotations.version> | ||
| 23 | <servlet.versoin>2.5</servlet.versoin> | 23 | <servlet.versoin>2.5</servlet.versoin> |
| 24 | <!-- DB 相关 --> | 24 | <!-- DB 相关 --> |
| 25 | <druid.version>1.2.8</druid.version> | 25 | <druid.version>1.2.8</druid.version> |
| 26 | <mybatis-plus.version>3.4.3.4</mybatis-plus.version> | 26 | <mybatis-plus.version>3.4.3.4</mybatis-plus.version> |
| 27 | <mybatis-plus-generator.version>3.5.2</mybatis-plus-generator.version> | 27 | <mybatis-plus-generator.version>3.5.2</mybatis-plus-generator.version> |
| 28 | <dynamic-datasource.version>3.5.0</dynamic-datasource.version> | 28 | <dynamic-datasource.version>3.5.0</dynamic-datasource.version> |
| 29 | - <redisson.version>3.17.0</redisson.version> | 29 | + <redisson.version>3.17.3</redisson.version> |
| 30 | <!-- Config 配置中心相关 --> | 30 | <!-- Config 配置中心相关 --> |
| 31 | <apollo.version>1.9.2</apollo.version> | 31 | <apollo.version>1.9.2</apollo.version> |
| 32 | <!-- Job 定时任务相关 --> | 32 | <!-- Job 定时任务相关 --> |
| 33 | <!-- 服务保障相关 --> | 33 | <!-- 服务保障相关 --> |
| 34 | <lock4j.version>2.2.0</lock4j.version> | 34 | <lock4j.version>2.2.0</lock4j.version> |
| 35 | - <resilience4j.version>1.7.0</resilience4j.version> | 35 | + <resilience4j.version>1.7.1</resilience4j.version> |
| 36 | <!-- 监控相关 --> | 36 | <!-- 监控相关 --> |
| 37 | <skywalking.version>8.7.0</skywalking.version> | 37 | <skywalking.version>8.7.0</skywalking.version> |
| 38 | - <spring-boot-admin.version>2.6.2</spring-boot-admin.version> | 38 | + <spring-boot-admin.version>2.6.7</spring-boot-admin.version> |
| 39 | <opentracing.version>0.31.0</opentracing.version> | 39 | <opentracing.version>0.31.0</opentracing.version> |
| 40 | <!-- Test 测试相关 --> | 40 | <!-- Test 测试相关 --> |
| 41 | <podam.version>7.2.6.RELEASE</podam.version> | 41 | <podam.version>7.2.6.RELEASE</podam.version> |
| 42 | <jedis-mock.version>0.1.16</jedis-mock.version> | 42 | <jedis-mock.version>0.1.16</jedis-mock.version> |
| 43 | - <mockito-inline.version>3.9.0</mockito-inline.version> | 43 | + <mockito-inline.version>4.0.0</mockito-inline.version> |
| 44 | <!-- Bpm 工作流相关 --> | 44 | <!-- Bpm 工作流相关 --> |
| 45 | <activiti.version>7.1.0.M6</activiti.version> | 45 | <activiti.version>7.1.0.M6</activiti.version> |
| 46 | <flowable.version>6.7.0</flowable.version> | 46 | <flowable.version>6.7.0</flowable.version> |
| @@ -52,7 +52,7 @@ | @@ -52,7 +52,7 @@ | ||
| 52 | <easyexcel.verion>2.2.7</easyexcel.verion> | 52 | <easyexcel.verion>2.2.7</easyexcel.verion> |
| 53 | <velocity.version>2.2</velocity.version> | 53 | <velocity.version>2.2</velocity.version> |
| 54 | <screw.version>1.0.5</screw.version> | 54 | <screw.version>1.0.5</screw.version> |
| 55 | - <fastjson.version>2.0.4</fastjson.version> | 55 | + <fastjson.version>2.0.5</fastjson.version> |
| 56 | <guava.version>30.1.1-jre</guava.version> | 56 | <guava.version>30.1.1-jre</guava.version> |
| 57 | <guice.version>5.1.0</guice.version> | 57 | <guice.version>5.1.0</guice.version> |
| 58 | <transmittable-thread-local.version>2.12.2</transmittable-thread-local.version> | 58 | <transmittable-thread-local.version>2.12.2</transmittable-thread-local.version> |
| @@ -476,13 +476,12 @@ | @@ -476,13 +476,12 @@ | ||
| 476 | <version>${velocity.version}</version> | 476 | <version>${velocity.version}</version> |
| 477 | </dependency> | 477 | </dependency> |
| 478 | 478 | ||
| 479 | - <!--fastjson漏洞升级此次事件影响fastjson 1.2.80及之前所有版本 --> | ||
| 480 | <dependency> | 479 | <dependency> |
| 481 | <groupId>com.alibaba</groupId> | 480 | <groupId>com.alibaba</groupId> |
| 482 | <artifactId>fastjson</artifactId> | 481 | <artifactId>fastjson</artifactId> |
| 483 | <version>${fastjson.version}</version> | 482 | <version>${fastjson.version}</version> |
| 484 | </dependency> | 483 | </dependency> |
| 485 | - | 484 | + |
| 486 | <dependency> | 485 | <dependency> |
| 487 | <groupId>cn.smallbun.screw</groupId> | 486 | <groupId>cn.smallbun.screw</groupId> |
| 488 | <artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> | 487 | <artifactId>screw-core</artifactId> <!-- 实现数据库文档 --> |
yudao-framework/yudao-spring-boot-starter-biz-data-permission/src/test/java/cn/iocoder/yudao/framework/datapermission/core/db/DataPermissionDatabaseInterceptorTest.java
| @@ -62,7 +62,7 @@ public class DataPermissionDatabaseInterceptorTest extends BaseMockitoUnitTest { | @@ -62,7 +62,7 @@ public class DataPermissionDatabaseInterceptorTest extends BaseMockitoUnitTest { | ||
| 62 | // 调用 | 62 | // 调用 |
| 63 | interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql); | 63 | interceptor.beforeQuery(null, mappedStatement, null, null, null, boundSql); |
| 64 | // 断言 | 64 | // 断言 |
| 65 | - pluginUtilsMock.verify(never(), () -> PluginUtils.mpBoundSql(boundSql)); | 65 | + pluginUtilsMock.verify(() -> PluginUtils.mpBoundSql(boundSql), never()); |
| 66 | } | 66 | } |
| 67 | } | 67 | } |
| 68 | 68 |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/config/YudaoSwaggerAutoConfiguration.java
| 1 | package cn.iocoder.yudao.framework.swagger.config; | 1 | package cn.iocoder.yudao.framework.swagger.config; |
| 2 | 2 | ||
| 3 | +import cn.iocoder.yudao.framework.swagger.core.SpringFoxHandlerProviderBeanPostProcessor; | ||
| 3 | import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; | 4 | import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j; |
| 4 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; | 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; |
| 5 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; | 6 | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; |
| @@ -21,8 +22,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | @@ -21,8 +22,6 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; | ||
| 21 | import java.util.Collections; | 22 | import java.util.Collections; |
| 22 | import java.util.List; | 23 | import java.util.List; |
| 23 | 24 | ||
| 24 | -import static springfox.documentation.builders.RequestHandlerSelectors.basePackage; | ||
| 25 | - | ||
| 26 | /** | 25 | /** |
| 27 | * Swagger2 自动配置类 | 26 | * Swagger2 自动配置类 |
| 28 | * | 27 | * |
| @@ -38,6 +37,11 @@ import static springfox.documentation.builders.RequestHandlerSelectors.basePacka | @@ -38,6 +37,11 @@ import static springfox.documentation.builders.RequestHandlerSelectors.basePacka | ||
| 38 | public class YudaoSwaggerAutoConfiguration { | 37 | public class YudaoSwaggerAutoConfiguration { |
| 39 | 38 | ||
| 40 | @Bean | 39 | @Bean |
| 40 | + public SpringFoxHandlerProviderBeanPostProcessor springFoxHandlerProviderBeanPostProcessor() { | ||
| 41 | + return new SpringFoxHandlerProviderBeanPostProcessor(); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Bean | ||
| 41 | @ConditionalOnMissingBean | 45 | @ConditionalOnMissingBean |
| 42 | public SwaggerProperties swaggerProperties() { | 46 | public SwaggerProperties swaggerProperties() { |
| 43 | return new SwaggerProperties(); | 47 | return new SwaggerProperties(); |
| @@ -52,8 +56,8 @@ public class YudaoSwaggerAutoConfiguration { | @@ -52,8 +56,8 @@ public class YudaoSwaggerAutoConfiguration { | ||
| 52 | .apiInfo(apiInfo(properties)) | 56 | .apiInfo(apiInfo(properties)) |
| 53 | // 设置扫描指定 package 包下的 | 57 | // 设置扫描指定 package 包下的 |
| 54 | .select() | 58 | .select() |
| 55 | - .apis(basePackage(properties.getBasePackage())) | ||
| 56 | -// .apis(basePackage("cn.iocoder.yudao.module.infra")) // 可用于 swagger 无法展示时使用 | 59 | +// .apis(basePackage(properties.getBasePackage())) |
| 60 | +// .apis(basePackage("cn.iocoder.yudao.module.system")) // 可用于 swagger 无法展示时使用 | ||
| 57 | .paths(PathSelectors.any()) | 61 | .paths(PathSelectors.any()) |
| 58 | .build() | 62 | .build() |
| 59 | .securitySchemes(securitySchemes()) | 63 | .securitySchemes(securitySchemes()) |
yudao-framework/yudao-spring-boot-starter-web/src/main/java/cn/iocoder/yudao/framework/swagger/core/SpringFoxHandlerProviderBeanPostProcessor.java
0 → 100644
| 1 | +package cn.iocoder.yudao.framework.swagger.core; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.util.ReflectUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 5 | +import org.springframework.beans.BeansException; | ||
| 6 | +import org.springframework.beans.factory.config.BeanPostProcessor; | ||
| 7 | +import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; | ||
| 8 | +import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; | ||
| 9 | +import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题 | ||
| 15 | + * 该问题对应的 issue 为 https://github.com/springfox/springfox/issues/3462 | ||
| 16 | + * | ||
| 17 | + * @author 芋道源码 | ||
| 18 | + */ | ||
| 19 | +public class SpringFoxHandlerProviderBeanPostProcessor implements BeanPostProcessor { | ||
| 20 | + | ||
| 21 | + @Override | ||
| 22 | + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { | ||
| 23 | + if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) { | ||
| 24 | + customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); | ||
| 25 | + } | ||
| 26 | + return bean; | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | + private <T extends RequestMappingInfoHandlerMapping> void customizeSpringfoxHandlerMappings(List<T> mappings) { | ||
| 30 | + // 移除,只保留 patternParser | ||
| 31 | + List<T> copy = CollectionUtils.filterList(mappings, mapping -> mapping.getPatternParser() == null); | ||
| 32 | + // 添加到 mappings 中 | ||
| 33 | + mappings.clear(); | ||
| 34 | + mappings.addAll(copy); | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | + @SuppressWarnings("unchecked") | ||
| 38 | + private List<RequestMappingInfoHandlerMapping> getHandlerMappings(Object bean) { | ||
| 39 | + return (List<RequestMappingInfoHandlerMapping>) | ||
| 40 | + ReflectUtil.getFieldValue(bean, "handlerMappings"); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | +} |
yudao-module-system/yudao-module-system-biz/src/test/java/cn/iocoder/yudao/module/system/controller/admin/oauth2/OAuth2OpenControllerTest.java
| @@ -77,7 +77,7 @@ public class OAuth2OpenControllerTest extends BaseMockitoUnitTest { | @@ -77,7 +77,7 @@ public class OAuth2OpenControllerTest extends BaseMockitoUnitTest { | ||
| 77 | 77 | ||
| 78 | // mock 方法(访问令牌) | 78 | // mock 方法(访问令牌) |
| 79 | OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class) | 79 | OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class) |
| 80 | - .setExpiresTime(addTime(Duration.ofMillis(30010L))); // 多给 10 毫秒,保证可执行完 | 80 | + .setExpiresTime(addTime(Duration.ofMillis(30050L))); // 多给 10 毫秒,保证可执行完 |
| 81 | when(oauth2GrantService.grantAuthorizationCodeForAccessToken(eq("test_client_id"), | 81 | when(oauth2GrantService.grantAuthorizationCodeForAccessToken(eq("test_client_id"), |
| 82 | eq(code), eq(redirectUri), eq(state))).thenReturn(accessTokenDO); | 82 | eq(code), eq(redirectUri), eq(state))).thenReturn(accessTokenDO); |
| 83 | 83 | ||
| @@ -105,7 +105,7 @@ public class OAuth2OpenControllerTest extends BaseMockitoUnitTest { | @@ -105,7 +105,7 @@ public class OAuth2OpenControllerTest extends BaseMockitoUnitTest { | ||
| 105 | 105 | ||
| 106 | // mock 方法(访问令牌) | 106 | // mock 方法(访问令牌) |
| 107 | OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class) | 107 | OAuth2AccessTokenDO accessTokenDO = randomPojo(OAuth2AccessTokenDO.class) |
| 108 | - .setExpiresTime(addTime(Duration.ofMillis(30010L))); // 多给 10 毫秒,保证可执行完 | 108 | + .setExpiresTime(addTime(Duration.ofMillis(30050L))); // 多给 10 毫秒,保证可执行完 |
| 109 | when(oauth2GrantService.grantPassword(eq(username), eq(password), eq("test_client_id"), | 109 | when(oauth2GrantService.grantPassword(eq(username), eq(password), eq("test_client_id"), |
| 110 | eq(Lists.newArrayList("write", "read")))).thenReturn(accessTokenDO); | 110 | eq(Lists.newArrayList("write", "read")))).thenReturn(accessTokenDO); |
| 111 | 111 |
yudao-server/pom.xml
| @@ -76,7 +76,7 @@ | @@ -76,7 +76,7 @@ | ||
| 76 | <plugin> | 76 | <plugin> |
| 77 | <groupId>org.springframework.boot</groupId> | 77 | <groupId>org.springframework.boot</groupId> |
| 78 | <artifactId>spring-boot-maven-plugin</artifactId> | 78 | <artifactId>spring-boot-maven-plugin</artifactId> |
| 79 | - <version>2.5.12</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 --> | 79 | + <version>2.6.7</version> <!-- 如果 spring.boot.version 版本修改,则这里也要跟着修改 --> |
| 80 | <configuration> | 80 | <configuration> |
| 81 | <fork>true</fork> | 81 | <fork>true</fork> |
| 82 | </configuration> | 82 | </configuration> |
yudao-server/src/main/resources/application.yaml
| @@ -5,12 +5,18 @@ spring: | @@ -5,12 +5,18 @@ spring: | ||
| 5 | profiles: | 5 | profiles: |
| 6 | active: local | 6 | active: local |
| 7 | 7 | ||
| 8 | + main: | ||
| 9 | + allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。 | ||
| 10 | + | ||
| 8 | # Servlet 配置 | 11 | # Servlet 配置 |
| 9 | servlet: | 12 | servlet: |
| 10 | # 文件上传相关配置项 | 13 | # 文件上传相关配置项 |
| 11 | multipart: | 14 | multipart: |
| 12 | max-file-size: 16MB # 单个文件大小 | 15 | max-file-size: 16MB # 单个文件大小 |
| 13 | max-request-size: 32MB # 设置总上传的文件大小 | 16 | max-request-size: 32MB # 设置总上传的文件大小 |
| 17 | + mvc: | ||
| 18 | + pathmatch: | ||
| 19 | + matching-strategy: ANT_PATH_MATCHER # 解决 SpringFox 与 SpringBoot 2.6.x 不兼容的问题,参见 SpringFoxHandlerProviderBeanPostProcessor 类 | ||
| 14 | 20 | ||
| 15 | # Jackson 配置项 | 21 | # Jackson 配置项 |
| 16 | jackson: | 22 | jackson: |