fix gitee #I3RGQL .

This commit is contained in:
shalousun 2021-05-15 22:30:04 +08:00
parent 40be476c48
commit 907bf1cbfb
2 changed files with 7 additions and 2 deletions

View File

@ -4,6 +4,7 @@
- 更新内容: - 更新内容:
1. 修复推送接口到torna丢失部分mock值的问题。 1. 修复推送接口到torna丢失部分mock值的问题。
2. 修复在参数注释中配置类替换时将非类名解析成类名的bug 。 2. 修复在参数注释中配置类替换时将非类名解析成类名的bug 。
3. 支持父类上加@RestController注解的子类能够被识别和扫描
#### 版本号2.1.7 #### 版本号2.1.7
- 更新日期: 2020-05-12 - 更新日期: 2020-05-12
- 更新内容: - 更新内容:

View File

@ -825,7 +825,10 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
} }
private boolean checkController(JavaClass cls) { private boolean checkController(JavaClass cls) {
List<JavaAnnotation> classAnnotations = cls.getAnnotations(); JavaClass superClass = cls.getSuperJavaClass();
List<JavaAnnotation> classAnnotations = new ArrayList<>();
classAnnotations.addAll(superClass.getAnnotations());
classAnnotations.addAll(cls.getAnnotations());
for (JavaAnnotation annotation : classAnnotations) { for (JavaAnnotation annotation : classAnnotations) {
String name = annotation.getType().getValue(); String name = annotation.getType().getValue();
if (SpringMvcAnnotations.CONTROLLER.equals(name) || SpringMvcAnnotations.REST_CONTROLLER.equals(name)) { if (SpringMvcAnnotations.CONTROLLER.equals(name) || SpringMvcAnnotations.REST_CONTROLLER.equals(name)) {
@ -912,7 +915,8 @@ public class SpringBootDocBuildTemplate implements IDocBuildTemplate<ApiDoc> {
} }
private List<JavaAnnotation> getAnnotations(JavaClass cls) { private List<JavaAnnotation> getAnnotations(JavaClass cls) {
List<JavaAnnotation> annotationsList = cls.getAnnotations(); List<JavaAnnotation> annotationsList = new ArrayList<>();
annotationsList.addAll(cls.getAnnotations());
boolean flag = annotationsList.stream().anyMatch(item -> { boolean flag = annotationsList.stream().anyMatch(item -> {
String annotationName = item.getType().getValue(); String annotationName = item.getType().getValue();
if (DocAnnotationConstants.REQUEST_MAPPING.equals(annotationName) || if (DocAnnotationConstants.REQUEST_MAPPING.equals(annotationName) ||