diff --git a/README.md b/README.md index 8a57b12..dc7cb15 100644 --- a/README.md +++ b/README.md @@ -133,6 +133,9 @@ When you need to use smart-doc to generate more API document information, you ca "className": "org.springframework.data.domain.Pageable", "replacementClassName": "com.power.doc.model.PageRequestDto" //Use custom PageRequestDto instead of JPA Pageable for document rendering. }], + "apiConstants": [{////Configure your own constant class, smart-doc automatically replaces with a specific value when parsing to a constant + "constantsClassName": "com.power.doc.constants.RequestParamConstant" + }],   "requestHeaders": [// Set global request headers, no need to set     {       "name": "token", diff --git a/README_CN.md b/README_CN.md index c7ed11b..b972410 100644 --- a/README_CN.md +++ b/README_CN.md @@ -140,6 +140,9 @@ smart-doc官方目前已经开发完成maven 插件和gradle,你可以根据 "className": "org.springframework.data.domain.Pageable", "replacementClassName": "com.power.doc.model.PageRequestDto" //自定义的PageRequestDto替换Pageable做文档渲染 }], + "apiConstants": [{//从1.8.9开始配置自己的常量类,smart-doc在解析到常量时自动替换为具体的值 + "constantsClassName": "com.power.doc.constants.RequestParamConstant" + }], "sourceCodePaths": [ //设置代码路径, 插件已经能够自动下载发布的源码包,没必要配置 { "path": "src/main/java", diff --git a/pom.xml b/pom.xml index d702e78..48346ef 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 smart-doc jar - 1.8.8 + 1.8.9 smart-doc https://github.com/shalousun/smart-doc.git @@ -59,7 +59,7 @@ com.github.shalousun common-util - 1.9.5 + 1.9.6 diff --git a/src/main/java/com/power/doc/handler/SpringMVCRequestMappingHandler.java b/src/main/java/com/power/doc/handler/SpringMVCRequestMappingHandler.java index ce36c37..66a9bc7 100644 --- a/src/main/java/com/power/doc/handler/SpringMVCRequestMappingHandler.java +++ b/src/main/java/com/power/doc/handler/SpringMVCRequestMappingHandler.java @@ -50,6 +50,7 @@ public class SpringMVCRequestMappingHandler { * @param serverUrl server url * @param controllerBaseUrl spring mvc controller base url * @param method JavaMethod + * @param constantsMap project constant container * @return RequestMapping */ public RequestMapping handle(String serverUrl, String controllerBaseUrl, JavaMethod method, Map constantsMap) { @@ -113,9 +114,11 @@ public class SpringMVCRequestMappingHandler { String value = entry.getValue(); if (url.contains(key)) { url = url.replace(key, value); + url = url.replace("+", ""); } if (shortUrl.contains(key)) { shortUrl = shortUrl.replace(key, value); + shortUrl = shortUrl.replace("+", ""); } } return RequestMapping.builder().setMediaType(mediaType).setMethodType(methodType)