From 7b24b37c0a70c9e3dad6f5fa4a08320e77c2c436 Mon Sep 17 00:00:00 2001 From: shalousun Date: Sun, 14 Nov 2021 22:26:04 +0800 Subject: [PATCH] supported controller implements interface. --- CHANGELOG.md | 3 +-- pom.xml | 4 ++-- .../power/doc/template/SpringBootDocBuildTemplate.java | 10 ++++++++++ 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b55b4ec..e08eb68 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,3 @@ - - ## smart-doc版本 #### 版本号:2.3.1 - 更新日期: 2021-11-13 @@ -8,6 +6,7 @@ 2. 修复response自定义tag设置返回未格式化换行问题。 3. 修复枚举类型字段指定mock不生效的问题。 4. 新增对@SessionAttribute参数做忽略。 + 5. 支持controller实现接口,并使用default方法。 #### 版本号:2.3.0 - 更新日期: 2021-11-07 diff --git a/pom.xml b/pom.xml index 15f5948..026dfc7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 smart-doc jar - 2.3.0 + 2.3.1 smart-doc https://github.com/smart-doc-group/smart-doc.git @@ -67,7 +67,7 @@ com.github.shalousun common-util - 2.0.9 + 2.1.0 com.google.code.gson diff --git a/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java b/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java index f905d9e..12dab79 100644 --- a/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java +++ b/src/main/java/com/power/doc/template/SpringBootDocBuildTemplate.java @@ -215,6 +215,16 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate { docJavaMethods.add(DocJavaMethod.builder().setJavaMethod(method).setActualTypesMap(actualTypesMap)); } } + List implClasses = cls.getImplements(); + for (JavaType type : implClasses) { + JavaClass javaClass = (JavaClass) type; + Map actualTypesMap = JavaClassUtil.getActualTypesMap(javaClass); + for (JavaMethod method : javaClass.getMethods()) { + if (method.isDefault()) { + docJavaMethods.add(DocJavaMethod.builder().setJavaMethod(method).setActualTypesMap(actualTypesMap)); + } + } + } List methodDocList = new ArrayList<>(methods.size()); int methodOrder = 0; for (DocJavaMethod docJavaMethod : docJavaMethods) {