Repository: springdoc/springdoc-openapi
Pull request #1024 (2021-01-18 10:17:47)

Change handler methods scanning strategy related to #1020
Related to #1020

Lack a new test in webflux module.


Patch:
diff --git a/pom.xml b/pom.xml
index ef088cb0f..0831d74e8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -11,7 +11,7 @@
 	<parent>
 		<groupId>org.springframework.boot</groupId>
 		<artifactId>spring-boot-starter-parent</artifactId>
-		<version>2.4.2</version>
+		<version>2.4.0</version>
 	</parent>
 
 	<licenses>
@@ -67,7 +67,7 @@
 		<maven-release-plugin.version>2.5.3</maven-release-plugin.version>
 		<nexus-staging-maven-plugin>1.6.8</nexus-staging-maven-plugin>
 		<swagger-api.version>2.1.6</swagger-api.version>
-		<swagger-ui.version>3.40.0</swagger-ui.version>
+		<swagger-ui.version>3.38.0</swagger-ui.version>
 		<spring-security-oauth2.version>2.3.8.RELEASE</spring-security-oauth2.version>
 		<classgraph.version>4.8.69</classgraph.version>
 		<webjars-locator-core.version>0.45</webjars-locator-core.version>
diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestService.java b/springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestService.java
index 612d6252e..6204dd1f3 100644
--- a/springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestService.java
+++ b/springdoc-openapi-common/src/main/java/org/springdoc/core/AbstractRequestService.java
@@ -44,7 +44,6 @@ import javax.validation.constraints.Pattern;
 import javax.validation.constraints.Size;
 
 import com.fasterxml.jackson.annotation.JsonView;
-import io.swagger.v3.core.util.PrimitiveType;
 import io.swagger.v3.oas.annotations.enums.ParameterIn;
 import io.swagger.v3.oas.models.Components;
 import io.swagger.v3.oas.models.OpenAPI;
@@ -461,17 +460,8 @@ public abstract class AbstractRequestService {
 		if (parameter.getSchema() == null && parameter.getContent() == null) {
 			Schema<?> schema = parameterBuilder.calculateSchema(components, parameterInfo, null,
 					jsonView);
-			if (parameterInfo.getDefaultValue() != null && schema != null) {
-				Object defaultValue = parameterInfo.getDefaultValue();
-				// Cast default value
-				PrimitiveType primitiveType = PrimitiveType.fromTypeAndFormat(schema.getType(), schema.getFormat());
-				if (primitiveType != null) {
-					Schema<?> primitiveSchema = primitiveType.createProperty();
-					primitiveSchema.setDefault(parameterInfo.getDefaultValue());
-					defaultValue = primitiveSchema.getDefault();
-				}
-				schema.setDefault(defaultValue);
-			}
+			if (parameterInfo.getDefaultValue() != null && schema !=null)
+				schema.setDefault(parameterInfo.getDefaultValue());
 			parameter.setSchema(schema);
 		}
 		return parameter;
diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/core/GenericParameterService.java b/springdoc-openapi-common/src/main/java/org/springdoc/core/GenericParameterService.java
index 17dbbd07e..5a6a8b76f 100644
--- a/springdoc-openapi-common/src/main/java/org/springdoc/core/GenericParameterService.java
+++ b/springdoc-openapi-common/src/main/java/org/springdoc/core/GenericParameterService.java
@@ -34,7 +34,6 @@ import java.util.Optional;
 import com.fasterxml.jackson.annotation.JsonView;
 import io.swagger.v3.core.util.AnnotationsUtils;
 import io.swagger.v3.core.util.Json;
-import io.swagger.v3.core.util.PrimitiveType;
 import io.swagger.v3.oas.annotations.enums.Explode;
 import io.swagger.v3.oas.annotations.media.ExampleObject;
 import io.swagger.v3.oas.models.Components;
@@ -50,9 +49,6 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springdoc.core.customizers.DelegatingMethodParameterCustomizer;
 
-import org.springframework.boot.autoconfigure.web.format.DateTimeFormatters;
-import org.springframework.boot.autoconfigure.web.format.WebConversionService;
-import org.springframework.boot.autoconfigure.web.reactive.WebFluxProperties.Format;
 import org.springframework.core.MethodParameter;
 import org.springframework.core.ResolvableType;
 import org.springframework.core.io.Resource;
@@ -75,11 +71,6 @@ public class GenericParameterService {
 	 */
 	private final Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer;
 
-	/**
-	 * The Web conversion service.
-	 */
-	private final WebConversionService webConversionService;
-
 	/**
 	 * The constant LOGGER.
 	 */
@@ -97,20 +88,13 @@ public class GenericParameterService {
 
 	/**
 	 * Instantiates a new Generic parameter builder.
+	 *
 	 * @param propertyResolverUtils the property resolver utils
 	 * @param optionalDelegatingMethodParameterCustomizer the optional delegating method parameter customizer
-	 * @param webConversionServiceOptional the web conversion service optional
 	 */
-	public GenericParameterService(PropertyResolverUtils propertyResolverUtils, Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer, Optional<WebConversionService> webConversionServiceOptional) {
+	public GenericParameterService(PropertyResolverUtils propertyResolverUtils,   Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer) {
 		this.propertyResolverUtils = propertyResolverUtils;
-		this.optionalDelegatingMethodParameterCustomizer = optionalDelegatingMethodParameterCustomizer;
-		if (webConversionServiceOptional.isPresent())
-			this.webConversionService = webConversionServiceOptional.get();
-		else {
-			final Format format = new Format();
-			this.webConversionService = new WebConversionService(new DateTimeFormatters()
-					.dateFormat(format.getDate()).timeFormat(format.getTime()).dateTimeFormat(format.getDateTime()));
-		}
+		this.optionalDelegatingMethodParameterCustomizer=optionalDelegatingMethodParameterCustomizer;
 	}
 
 	/**
@@ -272,16 +256,6 @@ public class GenericParameterService {
 			if (schema == null) {
 				schema = AnnotationsUtils.getArraySchema(parameterDoc.array(), components, jsonView).orElse(null);
 			}
-			// Cast default value
-			if (schema != null && schema.getDefault() != null) {
-				PrimitiveType primitiveType = PrimitiveType.fromTypeAndFormat(schema.getType(), schema.getFormat());
-				if (primitiveType != null) {
-					Schema<?> primitiveSchema = primitiveType.createProperty();
-					primitiveSchema.setDefault(schema.getDefault());
-					schema.setDefault(primitiveSchema.getDefault());
-				}
-			}
-
 			parameter.setSchema(schema);
 		}
 	}
@@ -486,14 +460,4 @@ public class GenericParameterService {
 	public PropertyResolverUtils getPropertyResolverUtils() {
 		return propertyResolverUtils;
 	}
-
-
-	/**
-	 * Gets web conversion service.
-	 *
-	 * @return the web conversion service
-	 */
-	public WebConversionService getWebConversionService() {
-		return webConversionService;
-	}
 }
diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/core/ParameterInfo.java b/springdoc-openapi-common/src/main/java/org/springdoc/core/ParameterInfo.java
index 36e08bdfb..da73d9c22 100644
--- a/springdoc-openapi-common/src/main/java/org/springdoc/core/ParameterInfo.java
+++ b/springdoc-openapi-common/src/main/java/org/springdoc/core/ParameterInfo.java
@@ -25,13 +25,11 @@ import java.lang.reflect.Parameter;
 import io.swagger.v3.oas.annotations.enums.ParameterIn;
 import org.apache.commons.lang3.StringUtils;
 
-import org.springframework.boot.autoconfigure.web.format.WebConversionService;
 import org.springframework.core.MethodParameter;
 import org.springframework.web.bind.annotation.CookieValue;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestHeader;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ValueConstants;
 
 /**
  * The type Parameter info.
@@ -62,7 +60,7 @@ public class ParameterInfo {
 	/**
 	 * The Default value.
 	 */
-	private Object defaultValue;
+	private String defaultValue;
 
 	/**
 	 * The Param type.
@@ -99,11 +97,8 @@ public class ParameterInfo {
 
 		if (StringUtils.isNotBlank(this.pName))
 			this.pName = propertyResolverUtils.resolve(this.pName);
-		if (this.defaultValue !=null && !ValueConstants.DEFAULT_NONE.equals(this.defaultValue.toString())){
-			this.defaultValue = propertyResolverUtils.resolve(this.defaultValue.toString());
-			WebConversionService conversionService = parameterBuilder.getWebConversionService();
-			this.defaultValue= conversionService.convert(this.defaultValue, methodParameter.getParameterType());
-		}
+		if (StringUtils.isNotBlank(this.defaultValue))
+			this.defaultValue = propertyResolverUtils.resolve(this.defaultValue);
 
 		this.required = this.required && !methodParameter.isOptional();
 	}
@@ -176,7 +171,7 @@ public class ParameterInfo {
 	 *
 	 * @return the default value
 	 */
-	public Object getDefaultValue() {
+	public String getDefaultValue() {
 		return defaultValue;
 	}
 
@@ -212,7 +207,7 @@ public class ParameterInfo {
 	 *
 	 * @param defaultValue the default value
 	 */
-	public void setDefaultValue(Object defaultValue) {
+	public void setDefaultValue(String defaultValue) {
 		this.defaultValue = defaultValue;
 	}
 
diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocAnnotationsUtils.java b/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocAnnotationsUtils.java
index ea7a6ef60..11dce9a31 100644
--- a/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocAnnotationsUtils.java
+++ b/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocAnnotationsUtils.java
@@ -106,7 +106,7 @@ public class SpringDocAnnotationsUtils extends AnnotationsUtils {
 	 */
 	public static Schema extractSchema(Components components, Type returnType, JsonView jsonView, Annotation[] annotations) {
 		Schema schemaN = null;
-		ResolvedSchema resolvedSchema;
+		ResolvedSchema resolvedSchema = null;
 		try {
 			resolvedSchema = ModelConverters.getInstance()
 					.resolveAsResolvedSchema(
diff --git a/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfiguration.java b/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfiguration.java
index b03e23682..10902b8a3 100644
--- a/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfiguration.java
+++ b/springdoc-openapi-common/src/main/java/org/springdoc/core/SpringDocConfiguration.java
@@ -59,7 +59,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
 import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingClass;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
-import org.springframework.boot.autoconfigure.web.format.WebConversionService;
 import org.springframework.context.ApplicationContext;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Conditional;
@@ -282,15 +281,12 @@ public class SpringDocConfiguration {
 	 *
 	 * @param propertyResolverUtils the property resolver utils
 	 * @param optionalDelegatingMethodParameterCustomizer the optional delegating method parameter customizer
-	 * @param webConversionServiceOptional the web conversion service
 	 * @return the generic parameter builder
 	 */
 	@Bean
 	@ConditionalOnMissingBean
-	GenericParameterService parameterBuilder(PropertyResolverUtils propertyResolverUtils,
-			Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer,
-			Optional<WebConversionService> webConversionServiceOptional) {
-		return new GenericParameterService(propertyResolverUtils,optionalDelegatingMethodParameterCustomizer, webConversionServiceOptional);
+	GenericParameterService parameterBuilder(PropertyResolverUtils propertyResolverUtils, Optional<DelegatingMethodParameterCustomizer> optionalDelegatingMethodParameterCustomizer) {
+		return new GenericParameterService(propertyResolverUtils,optionalDelegatingMethodParameterCustomizer);
 	}
 
 	/**
diff --git a/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java
index 1e96812af..420409377 100644
--- a/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java
+++ b/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/DataRestDelegatingMethodParameterCustomizer.java
@@ -62,7 +62,8 @@ public class DataRestDelegatingMethodParameterCustomizer implements DelegatingMe
 	@Override
 	public void customize(MethodParameter originalParameter, MethodParameter methodParameter) {
 		PageableDefault pageableDefault = originalParameter.getParameterAnnotation(PageableDefault.class);
-		if (pageableDefault != null || (org.springframework.data.domain.Pageable.class.isAssignableFrom(originalParameter.getParameterType()) && (optionalSpringDataWebProperties.isPresent() || optionalRepositoryRestConfiguration.isPresent()))) {
+		if (pageableDefault != null || (org.springframework.data.domain.Pageable.class.isAssignableFrom(originalParameter.getParameterType()) && (optionalSpringDataWebProperties.isPresent() || optionalRepositoryRestConfiguration.isPresent())))
+		{
 			Field field = FieldUtils.getDeclaredField(DelegatingMethodParameter.class, "additionalParameterAnnotations", true);
 			try {
 				Annotation[] parameterAnnotations = (Annotation[]) field.get(methodParameter);
@@ -99,7 +100,7 @@ public class DataRestDelegatingMethodParameterCustomizer implements DelegatingMe
 
 				@Override
 				public String name() {
-					return getName(parameterName, parameter.name());
+					return getName(parameterName, pageableDefault, parameter.name());
 				}
 
 				@Override
@@ -389,10 +390,11 @@ public class DataRestDelegatingMethodParameterCustomizer implements DelegatingMe
 	 * Gets name.
 	 *
 	 * @param parameterName the parameter name
+	 * @param pageableDefault the pageable default
 	 * @param originalName the original name
 	 * @return the name
 	 */
-	private String getName(String parameterName , String originalName) {
+	private String getName(String parameterName, PageableDefault pageableDefault, String originalName) {
 		String name = null;
 		switch (parameterName) {
 			case "size":
@@ -404,7 +406,9 @@ public class DataRestDelegatingMethodParameterCustomizer implements DelegatingMe
 					name = originalName;
 				break;
 			case "sort":
-				if (optionalRepositoryRestConfiguration.isPresent())
+				if (pageableDefault != null && ArrayUtils.isNotEmpty(pageableDefault.sort()))
+					name = String.join(",", pageableDefault.sort());
+				else if (optionalRepositoryRestConfiguration.isPresent())
 					name = optionalRepositoryRestConfiguration.get().getSortParamName();
 				else if (optionalSpringDataWebProperties.isPresent())
 					name = optionalSpringDataWebProperties.get().getSort().getSortParameter();
diff --git a/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/QuerydslPredicateOperationCustomizer.java b/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/QuerydslPredicateOperationCustomizer.java
index a0ca0effd..373e64d8b 100644
--- a/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/QuerydslPredicateOperationCustomizer.java
+++ b/springdoc-openapi-data-rest/src/main/java/org/springdoc/data/rest/customisers/QuerydslPredicateOperationCustomizer.java
@@ -275,7 +275,7 @@ public class QuerydslPredicateOperationCustomizer implements OperationCustomizer
 		}
 
 		if (parameter.getSchema() == null) {
-			Schema<?> schema ;
+			Schema<?> schema = null;
 			PrimitiveType primitiveType = PrimitiveType.fromType(type);
 			if (primitiveType != null) {
 				schema = primitiveType.createProperty();
diff --git a/springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerWelcomeCommon.java b/springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerWelcomeCommon.java
index fb55bd023..769a84799 100644
--- a/springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerWelcomeCommon.java
+++ b/springdoc-openapi-ui/src/main/java/org/springdoc/webmvc/ui/SwaggerWelcomeCommon.java
@@ -30,10 +30,6 @@ public abstract class SwaggerWelcomeCommon extends AbstractSwaggerWelcome {
 		buildConfigUrl(request.getContextPath(), ServletUriComponentsBuilder.fromCurrentContextPath());
 		String sbUrl =   swaggerUiConfigParameters.getUiRootPath() + SWAGGER_UI_URL;
 		UriComponentsBuilder uriBuilder = getUriComponentsBuilder(sbUrl);
-
-		// forward all queryParams from original request
-		request.getParameterMap().forEach(uriBuilder::queryParam);
-
 		return UrlBasedViewResolver.REDIRECT_URL_PREFIX + uriBuilder.build().encode().toString();
 	}
 
diff --git a/springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java b/springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java
index 5b3ee8c98..b9386c2a5 100644
--- a/springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java
+++ b/springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java
@@ -32,6 +32,7 @@ import java.util.Set;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import io.swagger.v3.core.util.PathUtils;
+import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.models.OpenAPI;
 import org.springdoc.api.AbstractOpenApiResource;
 import org.springdoc.core.AbstractRequestService;
@@ -47,6 +48,7 @@ import reactor.core.publisher.Mono;
 
 import org.springframework.beans.factory.ObjectFactory;
 import org.springframework.context.ApplicationContext;
+import org.springframework.core.annotation.AnnotationUtils;
 import org.springframework.http.server.reactive.ServerHttpRequest;
 import org.springframework.util.MimeType;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -63,7 +65,7 @@ import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
 
 /**
  * The type Open api resource.
- * @author bnasslahsen
+ * @author bnasslahsen, Azige
  */
 public abstract class OpenApiResource extends AbstractOpenApiResource {
 
@@ -186,8 +188,12 @@ public abstract class OpenApiResource extends AbstractOpenApiResource {
 				String[] produces =  requestMappingInfo.getProducesCondition().getProducibleMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
 				String[] consumes =  requestMappingInfo.getConsumesCondition().getConsumableMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
 				String[] headers =  requestMappingInfo.getHeadersCondition().getExpressions().stream().map(Object::toString).toArray(String[]::new);
-				if (operationPath.startsWith(DEFAULT_PATH_SEPARATOR)
-						&& (restControllers.containsKey(handlerMethod.getBean().toString()) || (isShowActuator()))
+				Operation operationAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Operation.class);
+				// Added operationAnnotation condition and made it consistent with the one in webmvc module for now
+				// Delete this message after review
+				if ((operationPath.startsWith(DEFAULT_PATH_SEPARATOR)
+							&& (restControllers.containsKey(handlerMethod.getBean().toString()) || (isShowActuator()))
+							|| operationAnnotation != null)
 						&& isFilterCondition(handlerMethod, operationPath, produces, consumes, headers)) {
 					Set<RequestMethod> requestMethods = requestMappingInfo.getMethodsCondition().getMethods();
 					// default allowed requestmethods
diff --git a/springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java b/springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java
index 59de31e55..250d01a63 100644
--- a/springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java
+++ b/springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java
@@ -34,6 +34,7 @@ import javax.servlet.http.HttpServletRequest;
 
 import com.fasterxml.jackson.core.JsonProcessingException;
 import io.swagger.v3.core.util.PathUtils;
+import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.models.OpenAPI;
 import org.springdoc.api.AbstractOpenApiResource;
 import org.springdoc.core.AbstractRequestService;
@@ -66,7 +67,7 @@ import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR;
 
 /**
  * The type Web mvc open api resource.
- * @author bnasslahsen
+ * @author bnasslahsen, Azige
  */
 public abstract class OpenApiResource extends AbstractOpenApiResource {
 
@@ -240,8 +241,10 @@ public abstract class OpenApiResource extends AbstractOpenApiResource {
 					String[] produces = requestMappingInfo.getProducesCondition().getProducibleMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
 					String[] consumes = requestMappingInfo.getConsumesCondition().getConsumableMediaTypes().stream().map(MimeType::toString).toArray(String[]::new);
 					String[] headers = requestMappingInfo.getHeadersCondition().getExpressions().stream().map(Object::toString).toArray(String[]::new);
+					Operation operationAnnotation = AnnotationUtils.findAnnotation(handlerMethod.getMethod(), Operation.class);
 					if (((isShowActuator() && optionalActuatorProvider.get().isRestController(operationPath, handlerMethod.getBeanType()))
-							|| isRestController(restControllers, handlerMethod, operationPath))
+							|| isRestController(restControllers, handlerMethod, operationPath)
+							|| operationAnnotation != null)
 							&& isFilterCondition(handlerMethod, operationPath, produces, consumes, headers)) {
 						Set<RequestMethod> requestMethods = requestMappingInfo.getMethodsCondition().getMethods();
 						// default allowed requestmethods


Test patch:
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app10.json b/springdoc-openapi-data-rest/src/test/resources/results/app10.json
index fca19230c..165c87183 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app10.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app10.json
@@ -585,7 +585,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -596,7 +596,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app11.json b/springdoc-openapi-data-rest/src/test/resources/results/app11.json
index 8e63e5d27..c4ffdb8c8 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app11.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app11.json
@@ -27,7 +27,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -38,7 +38,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app13.json b/springdoc-openapi-data-rest/src/test/resources/results/app13.json
index 87698c712..bde71cbf0 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app13.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app13.json
@@ -26,7 +26,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -37,11 +37,11 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 5
+              "default": "5"
             }
           },
           {
-            "name": "sort",
+            "name": "name",
             "in": "query",
             "description": "Sorting criteria in the format: property(,asc|desc). Default sort order is ascending. Multiple sort criteria are supported.",
             "required": false,
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app14.json b/springdoc-openapi-data-rest/src/test/resources/results/app14.json
index 298719c7c..4053c1f4f 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app14.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app14.json
@@ -26,7 +26,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -37,7 +37,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 25
+              "default": "25"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app15.json b/springdoc-openapi-data-rest/src/test/resources/results/app15.json
index dcbe15336..0606fae6c 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app15.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app15.json
@@ -26,7 +26,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -37,7 +37,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 50
+              "default": "50"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app16.json b/springdoc-openapi-data-rest/src/test/resources/results/app16.json
index ed4ceab11..726d5a61e 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app16.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app16.json
@@ -655,7 +655,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -666,7 +666,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app17.json b/springdoc-openapi-data-rest/src/test/resources/results/app17.json
index ff827fa28..a1434017b 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app17.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app17.json
@@ -27,7 +27,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -38,7 +38,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
@@ -353,7 +353,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -364,7 +364,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app20.json b/springdoc-openapi-data-rest/src/test/resources/results/app20.json
index bb0420b87..85978a1f8 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app20.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app20.json
@@ -26,7 +26,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -37,7 +37,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app3.json b/springdoc-openapi-data-rest/src/test/resources/results/app3.json
index b5588da88..96e765771 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app3.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app3.json
@@ -24,7 +24,7 @@
             "description": "Zero-based page index (0..N)",
             "schema": {
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -33,7 +33,7 @@
             "description": "The size of the page to be returned",
             "schema": {
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app7.json b/springdoc-openapi-data-rest/src/test/resources/results/app7.json
index 254402fc4..3f77ad323 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app7.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app7.json
@@ -26,7 +26,7 @@
             "schema": {
               "minimum": 0,
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -37,7 +37,7 @@
             "schema": {
               "minimum": 1,
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-data-rest/src/test/resources/results/app9.json b/springdoc-openapi-data-rest/src/test/resources/results/app9.json
index 34f4b2b4e..ae243d84f 100644
--- a/springdoc-openapi-data-rest/src/test/resources/results/app9.json
+++ b/springdoc-openapi-data-rest/src/test/resources/results/app9.json
@@ -32,7 +32,7 @@
             "description": "Zero-based page index (0..N)",
             "schema": {
               "type": "integer",
-              "default": 0
+              "default": "0"
             }
           },
           {
@@ -41,7 +41,7 @@
             "description": "The size of the page to be returned",
             "schema": {
               "type": "integer",
-              "default": 20
+              "default": "20"
             }
           },
           {
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocApp1Test.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocApp1Test.java
index 27037efff..18f95960c 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocApp1Test.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocApp1Test.java
@@ -19,33 +19,34 @@
 package test.org.springdoc.ui.app1;
 
 import org.junit.jupiter.api.Test;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
 import test.org.springdoc.ui.AbstractSpringDocTest;
 
-import static org.hamcrest.Matchers.containsString;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.test.web.servlet.MvcResult;
+
+import static org.junit.jupiter.api.Assertions.assertEquals;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 
 public class SpringDocApp1Test extends AbstractSpringDocTest {
 
-    @Test
-    public void shouldDisplaySwaggerUiPage() throws Exception {
-        mockMvc.perform(get("/swagger-ui/index.html"))
-                .andExpect(status().isOk())
-                .andExpect(content().string(containsString("Swagger UI")));
-    }
-
-    @Test
-    public void originalIndex() throws Exception {
-        mockMvc.perform(get("/swagger-ui/index.html"))
-                .andExpect(status().isOk())
-                .andExpect(content().string(containsString("Swagger UI")))
-                .andExpect(content().string(getExpectedResult()));
-    }
-
-    @SpringBootApplication
-    static class SpringDocTestApp {
-    }
+	@Test
+	public void shouldDisplaySwaggerUiPage() throws Exception {
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui/index.html")).andExpect(status().isOk()).andReturn();
+		String contentAsString = mvcResult.getResponse().getContentAsString();
+		assertTrue(contentAsString.contains("Swagger UI"));
+	}
+
+	@Test
+	public void originalIndex() throws Exception {
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui/index.html")).andExpect(status().isOk()).andReturn();
+		String transformedIndex = mvcResult.getResponse().getContentAsString();
+		assertTrue(transformedIndex.contains("Swagger UI"));
+		assertEquals(getExpectedResult(), transformedIndex);
+	}
+
+	@SpringBootApplication
+	static class SpringDocTestApp {}
 }
\ No newline at end of file
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocConfigPathsTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocConfigPathsTest.java
index 2f8c324b3..37910a503 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocConfigPathsTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocConfigPathsTest.java
@@ -19,32 +19,31 @@
 package test.org.springdoc.ui.app1;
 
 import org.junit.jupiter.api.Test;
+import test.org.springdoc.ui.AbstractSpringDocTest;
+
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.test.context.TestPropertySource;
-import test.org.springdoc.ui.AbstractSpringDocTest;
+import org.springframework.test.web.servlet.MvcResult;
 
-import static org.hamcrest.Matchers.containsString;
+import static org.junit.jupiter.api.Assertions.assertTrue;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.content;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = {
-        "springdoc.swagger-ui.path=/test/swagger.html",
-        "server.servlet.context-path=/context-path",
-        "spring.mvc.servlet.path=/servlet-path"
+		"springdoc.swagger-ui.path=/test/swagger.html",
+		"server.servlet.context-path=/context-path",
+		"spring.mvc.servlet.path=/servlet-path"
 })
 public class SpringDocConfigPathsTest extends AbstractSpringDocTest {
 
-    @Test
-    public void should_display_swaggerui_page() throws Exception {
-        mockMvc.perform(get("/context-path/servlet-path/test/swagger.html").contextPath("/context-path").servletPath("/servlet-path"))
-                .andExpect(status().isFound());
-        mockMvc.perform(get("/context-path/servlet-path/test/swagger-ui/index.html").contextPath("/context-path").servletPath("/servlet-path"))
-                .andExpect(status().isOk())
-                .andExpect(content().string(containsString("Swagger UI")));
-    }
+	@Test
+	public void should_display_swaggerui_page() throws Exception {
+		mockMvc.perform(get("/context-path/servlet-path/test/swagger.html").contextPath("/context-path").servletPath("/servlet-path")).andExpect(status().isFound()).andReturn();
+		MvcResult mvcResult = mockMvc.perform(get("/context-path/servlet-path/test/swagger-ui/index.html").contextPath("/context-path").servletPath("/servlet-path")).andExpect(status().isOk()).andReturn();
+		String contentAsString = mvcResult.getResponse().getContentAsString();
+		assertTrue(contentAsString.contains("Swagger UI"));
+	}
 
-    @SpringBootApplication
-    static class SpringDocTestApp {
-    }
+	@SpringBootApplication
+	static class SpringDocTestApp {}
 }
\ No newline at end of file
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectConfigUrlTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectConfigUrlTest.java
index 940fc6786..c6beab4be 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectConfigUrlTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectConfigUrlTest.java
@@ -27,7 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = {
@@ -38,9 +37,11 @@ public class SpringDocRedirectConfigUrlTest extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithConfigUrlIgnoringQueryParams() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?configUrl=/foo/bar"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?configUrl=/foo/bar", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectDefaultTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectDefaultTest.java
index 772c7ee0f..896ef2d68 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectDefaultTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectDefaultTest.java
@@ -26,16 +26,17 @@ import org.springframework.test.web.servlet.MvcResult;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 public class SpringDocRedirectDefaultTest extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithDefaultQueryParams() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectFilterTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectFilterTest.java
index 5b0316850..03877917c 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectFilterTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectFilterTest.java
@@ -27,7 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = "springdoc.swagger-ui.filter=false")
@@ -35,9 +34,11 @@ public class SpringDocRedirectFilterTest extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithConfigUrlIgnoringQueryParams() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&filter=false"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&filter=false", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectLayoutTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectLayoutTest.java
index 12bc9e1a3..ec851c376 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectLayoutTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectLayoutTest.java
@@ -27,7 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = "springdoc.swagger-ui.layout=BaseLayout")
@@ -35,9 +34,11 @@ public class SpringDocRedirectLayoutTest extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithConfigUrlIgnoringQueryParams() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&layout=BaseLayout"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&layout=BaseLayout", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectOriginalQueryParamsTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectOriginalQueryParamsTest.java
deleted file mode 100644
index 376a40dac..000000000
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectOriginalQueryParamsTest.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- *
- *  * Copyright 2019-2020 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.
- *  * You may obtain a copy of the License at
- *  *
- *  *      https://www.apache.org/licenses/LICENSE-2.0
- *  *
- *  * Unless required by applicable law or agreed to in writing, software
- *  * distributed under the License is distributed on an "AS IS" BASIS,
- *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  * See the License for the specific language governing permissions and
- *  * limitations under the License.
- *
- */
-
-package test.org.springdoc.ui.app1;
-
-import org.junit.jupiter.api.Test;
-import org.springframework.boot.autoconfigure.SpringBootApplication;
-import test.org.springdoc.ui.AbstractSpringDocTest;
-
-import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
-
-public class SpringDocRedirectOriginalQueryParamsTest extends AbstractSpringDocTest {
-
-    @Test
-    public void shouldRedirectWithOriginalQueryParams() throws Exception {
-        mockMvc.perform(get("/swagger-ui.html").queryParam("paramA", "123").queryParam("paramB", "e n c o d e d ! % &"))
-                .andExpect(status().isFound())
-                .andExpect(header().string("Location",
-                        "/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&paramA=123&paramB=e%20n%20c%20o%20d%20e%20d%20!%20%25%20%26"));
-    }
-
-    @Test
-    public void shouldRedirectWithOriginalQueryParamsHavingMultipleValues() throws Exception {
-        mockMvc.perform(get("/swagger-ui.html").queryParam("paramA", "1", "2", "3"))
-                .andExpect(status().isFound())
-                .andExpect(header().string("Location",
-                        "/swagger-ui/index.html?configUrl=/v3/api-docs/swagger-config&paramA=1&paramA=2&paramA=3"));
-    }
-
-    @SpringBootApplication
-    static class SpringDocTestApp {
-    }
-
-}
\ No newline at end of file
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams1Test.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams1Test.java
index 8cfae640d..4ba1d0407 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams1Test.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams1Test.java
@@ -27,7 +27,6 @@ import org.springframework.test.web.servlet.MvcResult;
 
 import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = "springdoc.swagger-ui.display-query-params-without-oauth2=true")
@@ -35,9 +34,11 @@ public class SpringDocRedirectQueryParams1Test extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithQueryParamsWithoutOauth2() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?url=/v3/api-docs"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?url=/v3/api-docs", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams2Test.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams2Test.java
index 24973f208..73f95e25f 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams2Test.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectQueryParams2Test.java
@@ -19,12 +19,14 @@
 package test.org.springdoc.ui.app1;
 
 import org.junit.jupiter.api.Test;
+import test.org.springdoc.ui.AbstractSpringDocTest;
+
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.test.context.TestPropertySource;
-import test.org.springdoc.ui.AbstractSpringDocTest;
+import org.springframework.test.web.servlet.MvcResult;
 
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.header;
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = "springdoc.swagger-ui.display-query-params=true")
@@ -32,9 +34,11 @@ public class SpringDocRedirectQueryParams2Test extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithQueryParams() throws Exception {
-        mockMvc.perform(get("/swagger-ui.html"))
-                .andExpect(status().isFound())
-                .andExpect(header().string("Location", "/swagger-ui/index.html?oauth2RedirectUrl=http://localhost/swagger-ui/oauth2-redirect.html&url=/v3/api-docs"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?oauth2RedirectUrl=http://localhost/swagger-ui/oauth2-redirect.html&url=/v3/api-docs", locationHeader);
 	}
 
 	@SpringBootApplication
diff --git a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectWithConfigTest.java b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectWithConfigTest.java
index 21f553b1d..e22d3bf0c 100644
--- a/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectWithConfigTest.java
+++ b/springdoc-openapi-ui/src/test/java/test/org/springdoc/ui/app1/SpringDocRedirectWithConfigTest.java
@@ -19,13 +19,17 @@
 package test.org.springdoc.ui.app1;
 
 import org.junit.jupiter.api.Test;
+import test.org.springdoc.ui.AbstractSpringDocTest;
+
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.test.context.TestPropertySource;
-import test.org.springdoc.ui.AbstractSpringDocTest;
+import org.springframework.test.web.servlet.MvcResult;
 
 import static org.hamcrest.Matchers.is;
+import static org.junit.jupiter.api.Assertions.assertEquals;
 import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get;
-import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath;
+import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
 
 @TestPropertySource(properties = {
 		"springdoc.swagger-ui.validatorUrl=/foo/validate",
@@ -35,12 +39,14 @@ public class SpringDocRedirectWithConfigTest extends AbstractSpringDocTest {
 
 	@Test
 	public void shouldRedirectWithConfiguredParams() throws Exception {
-		mockMvc.perform(get("/swagger-ui.html"))
-				.andExpect(status().isFound())
-				.andExpect(header().string("Location", "/swagger-ui/index.html?configUrl=/baf/batz/swagger-config"));
+		MvcResult mvcResult = mockMvc.perform(get("/swagger-ui.html"))
+				.andExpect(status().isFound()).andReturn();
+
+		String locationHeader = mvcResult.getResponse().getHeader("Location");
+		assertEquals("/swagger-ui/index.html?configUrl=/baf/batz/swagger-config", locationHeader);
 
 		mockMvc.perform(get("/baf/batz/swagger-config"))
-				.andExpect(status().isOk()).andExpect(jsonPath("$.validatorUrl", is("/foo/validate")));
+				.andExpect(status().isOk()).andExpect(jsonPath("$.validatorUrl", is("/foo/validate"))).andReturn();
 
 	}
 
diff --git a/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloController.java b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloController.java
index 99ab7df5c..8b03563f0 100644
--- a/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloController.java
+++ b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloController.java
@@ -18,40 +18,53 @@
 
 package test.org.springdoc.api.app149;
 
-import java.util.List;
-
+import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.enums.ParameterIn;
+import io.swagger.v3.oas.annotations.media.Content;
 import io.swagger.v3.oas.annotations.media.Schema;
 import io.swagger.v3.oas.annotations.responses.ApiResponse;
 
-import org.springframework.http.HttpStatus;
+import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.ResponseStatus;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.servlet.ModelAndView;
 
-@RestController
+/**
+ * To test the case a user does not use @RestController but puts @Operation on handler methods
+ * and wants these methods to be exposed.
+ *
+ * @author Azige
+ */
+@Controller
 public class HelloController {
 
-	@GetMapping("/test/")
-	@ApiResponse(responseCode = "204", description = "No content")
-	@ResponseStatus(value = HttpStatus.NO_CONTENT)
-	public void test(@RequestParam(defaultValue = "1") Integer toto) {
-
+	@GetMapping("/hello")
+	@Operation(responses = @ApiResponse(
+			responseCode = "200",
+			description = "OK",
+			content = @Content(schema = @Schema(implementation = HelloMessage.class))
+	))
+	public String hello() {
+		return "forward:/message";
 	}
 
-	@GetMapping("/test1")
-	@ApiResponse(responseCode = "204", description = "No content")
-	@ResponseStatus(value = HttpStatus.NO_CONTENT)
-	public void test1(@RequestParam @Parameter(schema = @Schema(defaultValue ="false", type = "boolean")) boolean toto) {
-
+	@GetMapping("/message")
+	@Operation
+	@ResponseBody
+	public HelloMessage message() {
+		return new HelloMessage("Lucky numbers!", 777);
 	}
 
-	@GetMapping("/test3")
-	@ApiResponse(responseCode = "204", description = "No content")
-	@ResponseStatus(value = HttpStatus.NO_CONTENT)
-	public void test3(@RequestParam(defaultValue = "users,123") List<String> toto) {
-
+	@GetMapping("/helloModelAndView")
+	@Operation(responses = @ApiResponse(
+			responseCode = "200",
+			description = "OK",
+			content = @Content(schema = @Schema(implementation = HelloMessage.class))
+	))
+	public ModelAndView helloModelAndView() {
+		ModelAndView mav = new ModelAndView();
+		mav.setViewName("forward:/message");
+		return mav;
 	}
-
 }
diff --git a/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloMessage.java b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloMessage.java
new file mode 100644
index 000000000..35868daf0
--- /dev/null
+++ b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/HelloMessage.java
@@ -0,0 +1,29 @@
+/*
+ *
+ *  * Copyright 2019-2020 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.
+ *  * You may obtain a copy of the License at
+ *  *
+ *  *      https://www.apache.org/licenses/LICENSE-2.0
+ *  *
+ *  * Unless required by applicable law or agreed to in writing, software
+ *  * distributed under the License is distributed on an "AS IS" BASIS,
+ *  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  * See the License for the specific language governing permissions and
+ *  * limitations under the License.
+ *
+ */
+
+package test.org.springdoc.api.app149;
+
+public class HelloMessage {
+	public String text;
+	public int number;
+
+	public HelloMessage(String text, int number) {
+		this.text = text;
+		this.number = number;
+	}
+}
diff --git a/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/SpringDocApp149Test.java b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/SpringDocApp149Test.java
index 72312ef9b..f988dbd2c 100644
--- a/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/SpringDocApp149Test.java
+++ b/springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/app149/SpringDocApp149Test.java
@@ -18,17 +18,12 @@
 
 package test.org.springdoc.api.app149;
 
-
 import test.org.springdoc.api.AbstractSpringDocTest;
 
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 
-/**
- * Tests Spring meta-annotations as method parameters
- */
 public class SpringDocApp149Test extends AbstractSpringDocTest {
 
 	@SpringBootApplication
 	static class SpringDocTestApp {}
-
 }
diff --git a/springdoc-openapi-webmvc-core/src/test/resources/results/app149.json b/springdoc-openapi-webmvc-core/src/test/resources/results/app149.json
index 49d950996..537635c82 100644
--- a/springdoc-openapi-webmvc-core/src/test/resources/results/app149.json
+++ b/springdoc-openapi-webmvc-core/src/test/resources/results/app149.json
@@ -11,85 +11,81 @@
     }
   ],
   "paths": {
-    "/test3": {
+    "/hello": {
       "get": {
         "tags": [
           "hello-controller"
         ],
-        "operationId": "test3",
-        "parameters": [
-          {
-            "name": "toto",
-            "in": "query",
-            "required": false,
-            "schema": {
-              "type": "array",
-              "items": {
-                "type": "string"
-              },
-              "default": [
-                "users",
-                "123"
-              ]
-            }
-          }
-        ],
+        "operationId": "hello",
         "responses": {
-          "204": {
-            "description": "No content"
+          "200": {
+            "description": "OK",
+            "content": {
+              "*/*": {
+                "schema": {
+                  "$ref": "#/components/schemas/HelloMessage"
+                }
+              }
+            }
           }
         }
       }
     },
-    "/test1": {
+    "/message": {
       "get": {
         "tags": [
           "hello-controller"
         ],
-        "operationId": "test1",
-        "parameters": [
-          {
-            "name": "toto",
-            "in": "query",
-            "required": true,
-            "schema": {
-              "type": "boolean",
-              "default": false
-            }
-          }
-        ],
+        "operationId": "message",
         "responses": {
-          "204": {
-            "description": "No content"
+          "200": {
+            "description": "OK",
+            "content": {
+              "*/*": {
+                "schema": {
+                  "$ref": "#/components/schemas/HelloMessage"
+                }
+              }
+            }
           }
         }
       }
     },
-    "/test/": {
+    "/helloModelAndView": {
       "get": {
         "tags": [
           "hello-controller"
         ],
-        "operationId": "test",
-        "parameters": [
-          {
-            "name": "toto",
-            "in": "query",
-            "required": false,
-            "schema": {
-              "type": "integer",
-              "format": "int32",
-              "default": 1
-            }
-          }
-        ],
+        "operationId": "helloModelAndView",
         "responses": {
-          "204": {
-            "description": "No content"
+          "200": {
+            "description": "OK",
+            "content": {
+              "*/*": {
+                "schema": {
+                  "$ref": "#/components/schemas/HelloMessage"
+                }
+              }
+            }
           }
         }
       }
     }
   },
-  "components": {}
+  "components": {
+    "schemas": {
+      "HelloMessage": {
+        "type": "object",
+        "properties": {
+          "number": {
+            "type": "integer",
+            "format": "int32"
+          },
+          "text": {
+            "type": "string"
+          }
+        }
+      }
+    }
+  }
 }