|
52 | 52 |
|
53 | 53 | import org.springframework.beans.factory.ObjectFactory;
|
54 | 54 | import org.springframework.core.annotation.AnnotatedElementUtils;
|
55 |
| -import org.springframework.core.annotation.AnnotationUtils; |
56 | 55 | import org.springframework.util.CollectionUtils;
|
57 | 56 | import org.springframework.util.MimeType;
|
58 | 57 | import org.springframework.web.bind.annotation.RequestMethod;
|
59 |
| -import org.springframework.web.bind.annotation.ResponseBody; |
60 | 58 | import org.springframework.web.method.HandlerMethod;
|
61 | 59 | import org.springframework.web.servlet.ModelAndView;
|
62 | 60 | import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition;
|
@@ -251,7 +249,7 @@ protected void calculatePath(Map<String, Object> restControllers, Map<RequestMap
|
251 | 249 | String[] produces = requestMappingInfo.getProducesCondition().getProducibleMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
|
252 | 250 | String[] consumes = requestMappingInfo.getConsumesCondition().getConsumableMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
|
253 | 251 | String[] headers = requestMappingInfo.getHeadersCondition().getExpressions().stream().map(Object::toString).toArray(String[]::new);
|
254 |
| - if (((isShowActuator() && optionalActuatorProvider.get().isRestController(operationPath, handlerMethod.getBeanType())) |
| 252 | + if (((isShowActuator() && optionalActuatorProvider.get().isRestController(operationPath, handlerMethod)) |
255 | 253 | || isRestController(restControllers, handlerMethod, operationPath))
|
256 | 254 | && isFilterCondition(handlerMethod, operationPath, produces, consumes, headers)) {
|
257 | 255 | Set<RequestMethod> requestMethods = requestMappingInfo.getMethodsCondition().getMethods();
|
@@ -308,11 +306,8 @@ protected boolean isRestController(Map<String, Object> restControllers, HandlerM
|
308 | 306 | boolean hasOperationAnnotation = AnnotatedElementUtils.hasAnnotation(handlerMethod.getMethod(), Operation.class);
|
309 | 307 | if (hasOperationAnnotation)
|
310 | 308 | return true;
|
311 |
| - ResponseBody responseBodyAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getBeanType(), ResponseBody.class); |
312 |
| - if (responseBodyAnnotation == null) |
313 |
| - responseBodyAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), ResponseBody.class); |
314 | 309 |
|
315 |
| - return (responseBodyAnnotation != null && restControllers.containsKey(handlerMethod.getBean().toString()) || isAdditionalRestController(handlerMethod.getBeanType())) |
| 310 | + return (containsResponseBody(handlerMethod) & restControllers.containsKey(handlerMethod.getBean().toString()) || isAdditionalRestController(handlerMethod.getBeanType())) |
316 | 311 | && operationPath.startsWith(DEFAULT_PATH_SEPARATOR)
|
317 | 312 | && (springDocConfigProperties.isModelAndViewAllowed() || !ModelAndView.class.isAssignableFrom(handlerMethod.getMethod().getReturnType()));
|
318 | 313 | }
|
|
0 commit comments