完善 WebConfiguration 注释,帮助阅读的人理解 /api 前缀

This commit is contained in:
YunaiV 2021-03-07 20:21:03 +08:00
parent cafb72b582
commit 4a23698876
4 changed files with 4 additions and 3 deletions

View File

@ -86,7 +86,7 @@
| [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) | | [MapStruct](https://mapstruct.org/) | Java Bean 转换 | 1.4.1 | [文档](http://www.iocoder.cn/Spring-Boot/MapStruct/?yudao) |
| [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) | | [Lombok](https://projectlombok.org/) | 消除冗长的 Java 代码 | 1.16.14 | [文档](http://www.iocoder.cn/Spring-Boot/Lombok/?yudao) |
| [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.7.0 | - | | [JUnit](https://junit.org/junit5/) | Java 单元测试框架 | 5.7.0 | - |
| [Mockito](https://junit.org/junit5/) | Java Mock 框架 | 3.6.28 | - | | [Mockito](https://github.com/mockito/mockito) | Java Mock 框架 | 3.6.28 | - |
**前端** **前端**

View File

@ -1 +0,0 @@
<http://www.iocoder.cn/Spring-Boot/Spring-Security/?github>

View File

@ -0,0 +1 @@
<https://www.iocoder.cn/Spring-Boot/Resilience4j/?yudao>

View File

@ -27,9 +27,10 @@ public class WebConfiguration implements WebMvcConfigurer {
@Override @Override
public void configurePathMatch(PathMatchConfigurer configurer) { public void configurePathMatch(PathMatchConfigurer configurer) {
// 设置 API 前缀仅仅匹配 controller 包下的
configurer.addPathPrefix(webProperties.getApiPrefix(), clazz -> configurer.addPathPrefix(webProperties.getApiPrefix(), clazz ->
clazz.isAnnotationPresent(RestController.class) clazz.isAnnotationPresent(RestController.class)
&& clazz.getPackage().getName().startsWith(webProperties.getControllerPackage())); && clazz.getPackage().getName().startsWith(webProperties.getControllerPackage())); // 仅仅匹配 controller
} }
// ========== Filter 相关 ========== // ========== Filter 相关 ==========