Avoid synthesizable annotation creation for @Bean/@Scope on scanning
Includes consistent (non-)use of AnnotationUtils/AnnotatedElementUtils. Issue: SPR-16933
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -22,7 +22,7 @@ import reactor.core.publisher.Mono;
|
||||
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.core.ReactiveAdapterRegistry;
|
||||
import org.springframework.core.annotation.AnnotationUtils;
|
||||
import org.springframework.core.annotation.AnnotatedElementUtils;
|
||||
import org.springframework.http.codec.HttpMessageWriter;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import org.springframework.web.reactive.HandlerResult;
|
||||
@@ -53,9 +53,7 @@ public class ResponseBodyResultHandler extends AbstractMessageWriterResultHandle
|
||||
* @param writers writers for serializing to the response body
|
||||
* @param resolver to determine the requested content type
|
||||
*/
|
||||
public ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers,
|
||||
RequestedContentTypeResolver resolver) {
|
||||
|
||||
public ResponseBodyResultHandler(List<HttpMessageWriter<?>> writers, RequestedContentTypeResolver resolver) {
|
||||
this(writers, resolver, ReactiveAdapterRegistry.getSharedInstance());
|
||||
}
|
||||
|
||||
@@ -75,10 +73,10 @@ public class ResponseBodyResultHandler extends AbstractMessageWriterResultHandle
|
||||
|
||||
@Override
|
||||
public boolean supports(HandlerResult result) {
|
||||
MethodParameter parameter = result.getReturnTypeSource();
|
||||
Class<?> containingClass = parameter.getContainingClass();
|
||||
return (AnnotationUtils.findAnnotation(containingClass, ResponseBody.class) != null ||
|
||||
parameter.getMethodAnnotation(ResponseBody.class) != null);
|
||||
MethodParameter returnType = result.getReturnTypeSource();
|
||||
Class<?> containingClass = returnType.getContainingClass();
|
||||
return (AnnotatedElementUtils.hasAnnotation(containingClass, ResponseBody.class) ||
|
||||
returnType.hasMethodAnnotation(ResponseBody.class));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user