Skip to content

Commit a33e929

Browse files
committed
Malformed api-docs JSON when StringHttpMessageConverter is not active. Fixes #2051
1 parent f27ff76 commit a33e929

File tree

20 files changed

+166
-32
lines changed

20 files changed

+166
-32
lines changed

springdoc-openapi-common/src/main/java/org/springdoc/api/AbstractOpenApiResource.java

+4-4
Original file line numberDiff line numberDiff line change
@@ -1236,7 +1236,7 @@ protected void initOpenAPIBuilder(Locale locale) {
12361236
* @return the string
12371237
* @throws JsonProcessingException the json processing exception
12381238
*/
1239-
protected String writeYamlValue(OpenAPI openAPI) throws JsonProcessingException {
1239+
protected byte[] writeYamlValue(OpenAPI openAPI) throws JsonProcessingException {
12401240
String result;
12411241
ObjectMapper objectMapper = springDocProviders.yamlMapper();
12421242
if (springDocConfigProperties.isWriterWithOrderByKeys())
@@ -1247,7 +1247,7 @@ protected String writeYamlValue(OpenAPI openAPI) throws JsonProcessingException
12471247
result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI);
12481248
else
12491249
result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI);
1250-
return result;
1250+
return result.getBytes(StandardCharsets.UTF_8);
12511251
}
12521252

12531253
/**
@@ -1307,7 +1307,7 @@ protected boolean isActuatorRestController(String operationPath, HandlerMethod h
13071307
* @return the string
13081308
* @throws JsonProcessingException the json processing exception
13091309
*/
1310-
protected String writeJsonValue(OpenAPI openAPI) throws JsonProcessingException {
1310+
protected byte[] writeJsonValue(OpenAPI openAPI) throws JsonProcessingException {
13111311
String result;
13121312
ObjectMapper objectMapper = springDocProviders.jsonMapper();
13131313
if (springDocConfigProperties.isWriterWithOrderByKeys())
@@ -1316,7 +1316,7 @@ protected String writeJsonValue(OpenAPI openAPI) throws JsonProcessingException
13161316
result = objectMapper.writerFor(OpenAPI.class).writeValueAsString(openAPI);
13171317
else
13181318
result = objectMapper.writerWithDefaultPrettyPrinter().forType(OpenAPI.class).writeValueAsString(openAPI);
1319-
return result;
1319+
return result.getBytes(StandardCharsets.UTF_8);
13201320
}
13211321

13221322
/**

springdoc-openapi-common/src/main/java/org/springdoc/core/converters/JavaTypeToIgnoreConverter.java

-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
import io.swagger.v3.core.converter.ModelConverter;
3030
import io.swagger.v3.core.converter.ModelConverterContext;
3131
import io.swagger.v3.oas.models.media.Schema;
32-
import org.springdoc.core.AbstractRequestService;
3332
import org.springdoc.core.providers.ObjectMapperProvider;
3433

3534
/**

springdoc-openapi-kotlin/src/test/kotlin/test/org/springdoc/api/app7/ExampleController.kt

-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
package test.org.springdoc.api.app7
22

33
import io.swagger.v3.oas.annotations.Parameter
4-
import io.swagger.v3.oas.annotations.parameters.RequestBody
54
import org.springframework.web.bind.annotation.GetMapping
6-
import org.springframework.web.bind.annotation.PostMapping
7-
import org.springframework.web.bind.annotation.RequestMapping
85
import org.springframework.web.bind.annotation.RequestParam
96
import org.springframework.web.bind.annotation.RestController
107

springdoc-openapi-kotlin/src/test/kotlin/test/org/springdoc/api/app9/DemoController.kt

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
package test.org.springdoc.api.app9
22

33
import io.swagger.v3.oas.annotations.media.Schema
4-
import org.springframework.web.bind.annotation.*
4+
import org.springframework.web.bind.annotation.GetMapping
5+
import org.springframework.web.bind.annotation.RequestMapping
6+
import org.springframework.web.bind.annotation.RestController
57

68
@RestController
79
@RequestMapping("/api/demo")

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/MultipleOpenApiActuatorResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public MultipleOpenApiActuatorResource(List<GroupedOpenApi> groupedOpenApis, Obj
8383
*/
8484
@Operation(hidden = true)
8585
@GetMapping(value = "/{group}", produces = MediaType.APPLICATION_JSON_VALUE)
86-
public Mono<String> openapiJson(ServerHttpRequest
86+
public Mono<byte[]> openapiJson(ServerHttpRequest
8787
serverHttpRequest, @Value(API_DOCS_URL) String apiDocsUrl,
8888
@PathVariable String group, Locale locale)
8989
throws JsonProcessingException {
@@ -102,7 +102,7 @@ public Mono<String> openapiJson(ServerHttpRequest
102102
*/
103103
@Operation(hidden = true)
104104
@GetMapping(value = "/{group}/yaml", produces = APPLICATION_OPENAPI_YAML)
105-
public Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest,
105+
public Mono<byte[]> openapiYaml(ServerHttpRequest serverHttpRequest,
106106
@Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl, @PathVariable String
107107
group, Locale locale) throws JsonProcessingException {
108108
return getOpenApiResourceOrThrow(group).openapiYaml(serverHttpRequest, apiDocsUrl + DEFAULT_PATH_SEPARATOR + group, locale);

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/MultipleOpenApiWebFluxResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public MultipleOpenApiWebFluxResource(List<GroupedOpenApi> groupedOpenApis, Obje
8282
*/
8383
@Operation(hidden = true)
8484
@GetMapping(value = API_DOCS_URL + "/{group}", produces = MediaType.APPLICATION_JSON_VALUE)
85-
public Mono<String> openapiJson(ServerHttpRequest
85+
public Mono<byte[]> openapiJson(ServerHttpRequest
8686
serverHttpRequest, @Value(API_DOCS_URL) String apiDocsUrl, @PathVariable String
8787
group, Locale locale) throws JsonProcessingException {
8888
return getOpenApiResourceOrThrow(group).openapiJson(serverHttpRequest, apiDocsUrl + DEFAULT_PATH_SEPARATOR + group, locale);
@@ -100,7 +100,7 @@ public Mono<String> openapiJson(ServerHttpRequest
100100
*/
101101
@Operation(hidden = true)
102102
@GetMapping(value = DEFAULT_API_DOCS_URL_YAML + "/{group}", produces = APPLICATION_OPENAPI_YAML)
103-
public Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest,
103+
public Mono<byte[]> openapiYaml(ServerHttpRequest serverHttpRequest,
104104
@Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl, @PathVariable String
105105
group, Locale locale) throws JsonProcessingException {
106106
return getOpenApiResourceOrThrow(group).openapiYaml(serverHttpRequest, apiDocsUrl + DEFAULT_PATH_SEPARATOR + group, locale);

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiActuatorResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public OpenApiActuatorResource(ObjectFactory<OpenAPIService> openAPIBuilderObjec
108108
*/
109109
@Operation(hidden = true)
110110
@GetMapping(value = DEFAULT_PATH_SEPARATOR, produces = MediaType.APPLICATION_JSON_VALUE)
111-
public Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, Locale locale)
111+
public Mono<byte[]> openapiJson(ServerHttpRequest serverHttpRequest, Locale locale)
112112
throws JsonProcessingException {
113113
return super.openapiJson(serverHttpRequest, EMPTY, locale);
114114
}
@@ -124,7 +124,7 @@ public Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, Locale loca
124124
*/
125125
@Operation(hidden = true)
126126
@GetMapping(value = DEFAULT_YAML_API_DOCS_ACTUATOR_PATH, produces = APPLICATION_OPENAPI_YAML)
127-
public Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest, Locale locale)
127+
public Mono<byte[]> openapiYaml(ServerHttpRequest serverHttpRequest, Locale locale)
128128
throws JsonProcessingException {
129129
return super.openapiYaml(serverHttpRequest, YAML, locale);
130130
}

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public OpenApiResource(ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory
130130
* @return the mono
131131
* @throws JsonProcessingException the json processing exception
132132
*/
133-
protected Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, String apiDocsUrl, Locale locale)
133+
protected Mono<byte[]> openapiJson(ServerHttpRequest serverHttpRequest, String apiDocsUrl, Locale locale)
134134
throws JsonProcessingException {
135135
calculateServerUrl(serverHttpRequest, apiDocsUrl, locale);
136136
OpenAPI openAPI = this.getOpenApi(locale);
@@ -146,7 +146,7 @@ protected Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, String a
146146
* @return the mono
147147
* @throws JsonProcessingException the json processing exception
148148
*/
149-
protected Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest, String apiDocsUrl, Locale locale)
149+
protected Mono<byte[]> openapiYaml(ServerHttpRequest serverHttpRequest, String apiDocsUrl, Locale locale)
150150
throws JsonProcessingException {
151151
calculateServerUrl(serverHttpRequest, apiDocsUrl, locale);
152152
OpenAPI openAPI = this.getOpenApi(locale);

springdoc-openapi-webflux-core/src/main/java/org/springdoc/webflux/api/OpenApiWebfluxResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public OpenApiWebfluxResource(ObjectFactory<OpenAPIService> openAPIBuilderObject
112112
@Operation(hidden = true)
113113
@GetMapping(value = API_DOCS_URL, produces = MediaType.APPLICATION_JSON_VALUE)
114114
@Override
115-
public Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, @Value(API_DOCS_URL) String apiDocsUrl, Locale locale)
115+
public Mono<byte[]> openapiJson(ServerHttpRequest serverHttpRequest, @Value(API_DOCS_URL) String apiDocsUrl, Locale locale)
116116
throws JsonProcessingException {
117117
return super.openapiJson(serverHttpRequest, apiDocsUrl, locale);
118118
}
@@ -129,7 +129,7 @@ public Mono<String> openapiJson(ServerHttpRequest serverHttpRequest, @Value(API_
129129
@Operation(hidden = true)
130130
@GetMapping(value = DEFAULT_API_DOCS_URL_YAML, produces = APPLICATION_OPENAPI_YAML)
131131
@Override
132-
public Mono<String> openapiYaml(ServerHttpRequest serverHttpRequest,
132+
public Mono<byte[]> openapiYaml(ServerHttpRequest serverHttpRequest,
133133
@Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl, Locale locale) throws JsonProcessingException {
134134
return super.openapiYaml(serverHttpRequest, apiDocsUrl, locale);
135135
}

springdoc-openapi-webflux-core/src/test/java/test/org/springdoc/api/app81/SpringDocApp81Test.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
package test.org.springdoc.api.app81;
2424

2525
import java.net.URI;
26+
import java.nio.charset.StandardCharsets;
2627
import java.util.ArrayList;
2728
import java.util.Comparator;
2829
import java.util.List;
@@ -69,7 +70,9 @@ public void shouldGenerateOperationIdsDeterministically() throws Exception {
6970
when(request.getURI()).thenReturn(URI.create("http://localhost"));
7071

7172
String expected = getContent("results/app81.json");
72-
String openApi = resource.openapiJson(request, "", Locale.US).block();
73+
byte[] openApiBytes =resource.openapiJson(request, "", Locale.US).block();
74+
String openApi = new String(openApiBytes, StandardCharsets.UTF_8); // for UTF-8 encoding
75+
7376
assertEquals(expected, openApi, true);
7477
}
7578

springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/MultipleOpenApiActuatorResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public MultipleOpenApiActuatorResource(List<GroupedOpenApi> groupedOpenApis, Obj
8282
*/
8383
@Operation(hidden = true)
8484
@GetMapping(value = "/{group}", produces = MediaType.APPLICATION_JSON_VALUE)
85-
public String openapiJson(HttpServletRequest request, @PathVariable String group, Locale locale)
85+
public byte[] openapiJson(HttpServletRequest request, @PathVariable String group, Locale locale)
8686
throws JsonProcessingException {
8787
return getOpenApiResourceOrThrow(group).openapiJson(request, "" + DEFAULT_PATH_SEPARATOR + group, locale);
8888
}
@@ -98,7 +98,7 @@ public String openapiJson(HttpServletRequest request, @PathVariable String group
9898
*/
9999
@Operation(hidden = true)
100100
@GetMapping(value = "/{group}/yaml", produces = APPLICATION_OPENAPI_YAML)
101-
public String openapiYaml(HttpServletRequest request, @PathVariable String group, Locale locale)
101+
public byte[] openapiYaml(HttpServletRequest request, @PathVariable String group, Locale locale)
102102
throws JsonProcessingException {
103103
return getOpenApiResourceOrThrow(group).openapiYaml(request, "" + DEFAULT_PATH_SEPARATOR + group, locale);
104104
}

springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/MultipleOpenApiWebMvcResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ public MultipleOpenApiWebMvcResource(List<GroupedOpenApi> groupedOpenApis, Objec
8282
*/
8383
@Operation(hidden = true)
8484
@GetMapping(value = API_DOCS_URL + "/{group}", produces = MediaType.APPLICATION_JSON_VALUE)
85-
public String openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) String apiDocsUrl,
85+
public byte[] openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) String apiDocsUrl,
8686
@PathVariable String group, Locale locale)
8787
throws JsonProcessingException {
8888
return getOpenApiResourceOrThrow(group).openapiJson(request, apiDocsUrl + DEFAULT_PATH_SEPARATOR + group, locale);
@@ -100,7 +100,7 @@ public String openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) Strin
100100
*/
101101
@Operation(hidden = true)
102102
@GetMapping(value = DEFAULT_API_DOCS_URL_YAML + "/{group}", produces = APPLICATION_OPENAPI_YAML)
103-
public String openapiYaml(HttpServletRequest request, @Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl,
103+
public byte[] openapiYaml(HttpServletRequest request, @Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl,
104104
@PathVariable String group, Locale locale)
105105
throws JsonProcessingException {
106106
return getOpenApiResourceOrThrow(group).openapiYaml(request, apiDocsUrl + DEFAULT_PATH_SEPARATOR + group, locale);

springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiActuatorResource.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ public OpenApiActuatorResource(String groupName, ObjectFactory<OpenAPIService> o
120120
*/
121121
@Operation(hidden = true)
122122
@GetMapping(value = DEFAULT_PATH_SEPARATOR, produces = MediaType.APPLICATION_JSON_VALUE)
123-
public String openapiJson(HttpServletRequest request, Locale locale)
123+
public byte[] openapiJson(HttpServletRequest request, Locale locale)
124124
throws JsonProcessingException {
125-
return super.openapiJson(request, EMPTY, locale);
125+
return openapiJson(request, EMPTY, locale);
126126
}
127127

128128

@@ -136,7 +136,7 @@ public String openapiJson(HttpServletRequest request, Locale locale)
136136
*/
137137
@Operation(hidden = true)
138138
@GetMapping(value = DEFAULT_YAML_API_DOCS_ACTUATOR_PATH, produces = APPLICATION_OPENAPI_YAML)
139-
public String openapiYaml(HttpServletRequest request, Locale locale)
139+
public byte[] openapiYaml(HttpServletRequest request, Locale locale)
140140
throws JsonProcessingException {
141141
return super.openapiYaml(request, YAML, locale);
142142
}

springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public OpenApiResource(ObjectFactory<OpenAPIService> openAPIBuilderObjectFactory
132132
* @return the string
133133
* @throws JsonProcessingException the json processing exception
134134
*/
135-
public String openapiJson(HttpServletRequest request,
135+
public byte[] openapiJson(HttpServletRequest request,
136136
String apiDocsUrl, Locale locale)
137137
throws JsonProcessingException {
138138
calculateServerUrl(request, apiDocsUrl, locale);
@@ -149,7 +149,7 @@ public String openapiJson(HttpServletRequest request,
149149
* @return the string
150150
* @throws JsonProcessingException the json processing exception
151151
*/
152-
public String openapiYaml(HttpServletRequest request,
152+
public byte[] openapiYaml(HttpServletRequest request,
153153
String apiDocsUrl, Locale locale)
154154
throws JsonProcessingException {
155155
calculateServerUrl(request, apiDocsUrl, locale);

springdoc-openapi-webmvc-core/src/main/java/org/springdoc/webmvc/api/OpenApiWebMvcResource.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public OpenApiWebMvcResource(ObjectFactory<OpenAPIService> openAPIBuilderObjectF
111111
@Operation(hidden = true)
112112
@GetMapping(value = API_DOCS_URL, produces = MediaType.APPLICATION_JSON_VALUE)
113113
@Override
114-
public String openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) String apiDocsUrl, Locale locale)
114+
public byte[] openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) String apiDocsUrl, Locale locale)
115115
throws JsonProcessingException {
116116
return super.openapiJson(request, apiDocsUrl, locale);
117117
}
@@ -128,7 +128,7 @@ public String openapiJson(HttpServletRequest request, @Value(API_DOCS_URL) Strin
128128
@Operation(hidden = true)
129129
@GetMapping(value = DEFAULT_API_DOCS_URL_YAML, produces = APPLICATION_OPENAPI_YAML)
130130
@Override
131-
public String openapiYaml(HttpServletRequest request, @Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl, Locale locale)
131+
public byte[] openapiYaml(HttpServletRequest request, @Value(DEFAULT_API_DOCS_URL_YAML) String apiDocsUrl, Locale locale)
132132
throws JsonProcessingException {
133133
return super.openapiYaml(request, apiDocsUrl, locale);
134134
}

springdoc-openapi-webmvc-core/src/test/java/test/org/springdoc/api/v30/app136/SpringDocApp136Test.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
*/
2222
package test.org.springdoc.api.v30.app136;
2323

24+
import java.nio.charset.StandardCharsets;
2425
import java.util.ArrayList;
2526
import java.util.Comparator;
2627
import java.util.List;
@@ -67,7 +68,8 @@ public void shouldGenerateOperationIdsDeterministically() throws Exception {
6768
when(request.getRequestURL()).thenReturn(new StringBuffer("http://localhost"));
6869

6970
String expected = getContent("results/3.0.1/app136.json");
70-
String openApi = resource.openapiJson(request, "", Locale.getDefault());
71+
byte[] openApiBytes = resource.openapiJson(request, "", Locale.getDefault());
72+
String openApi = new String(openApiBytes, StandardCharsets.UTF_8); // for UTF-8 encoding
7173
assertEquals(expected, openApi, true);
7274
}
7375

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
package test.org.springdoc.api.v30.app201;
2+
3+
import io.swagger.v3.oas.annotations.Operation;
4+
import io.swagger.v3.oas.annotations.responses.ApiResponse;
5+
6+
import org.springframework.http.HttpStatus;
7+
import org.springframework.web.bind.annotation.ExceptionHandler;
8+
import org.springframework.web.bind.annotation.GetMapping;
9+
import org.springframework.web.bind.annotation.RequestMapping;
10+
import org.springframework.web.bind.annotation.ResponseStatus;
11+
import org.springframework.web.bind.annotation.RestController;
12+
13+
/**
14+
* @author bnasslahsen
15+
*/
16+
@RestController
17+
@RequestMapping("/example2")
18+
public class Example2Controller {
19+
20+
@ExceptionHandler(Exception.class)
21+
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
22+
@ApiResponse(responseCode = "500", description = "ExceptionHandler in example2")
23+
public String customControllerException() {
24+
return "example2";
25+
}
26+
27+
@GetMapping("/500")
28+
@Operation(
29+
tags = "example2",
30+
summary = "Example2 method",
31+
description = "This method is an example2"
32+
)
33+
public void test() {
34+
throw new RuntimeException();
35+
}
36+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
/*
2+
*
3+
* *
4+
* * *
5+
* * * * Copyright 2019-2022 the original author or authors.
6+
* * * *
7+
* * * * Licensed under the Apache License, Version 2.0 (the "License");
8+
* * * * you may not use this file except in compliance with the License.
9+
* * * * You may obtain a copy of the License at
10+
* * * *
11+
* * * * https://www.apache.org/licenses/LICENSE-2.0
12+
* * * *
13+
* * * * Unless required by applicable law or agreed to in writing, software
14+
* * * * distributed under the License is distributed on an "AS IS" BASIS,
15+
* * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* * * * See the License for the specific language governing permissions and
17+
* * * * limitations under the License.
18+
* * *
19+
* *
20+
*
21+
*/
22+
23+
package test.org.springdoc.api.v30.app201;
24+
25+
import test.org.springdoc.api.v30.AbstractSpringDocV30Test;
26+
27+
import org.springframework.boot.autoconfigure.SpringBootApplication;
28+
29+
public class SpringDocApp201Test extends AbstractSpringDocV30Test {
30+
31+
@SpringBootApplication
32+
static class SpringDocTestApp {}
33+
34+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package test.org.springdoc.api.v30.app201;
2+
3+
import java.util.List;
4+
5+
import org.springframework.http.converter.HttpMessageConverter;
6+
import org.springframework.http.converter.StringHttpMessageConverter;
7+
import org.springframework.stereotype.Component;
8+
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
9+
10+
/**
11+
* @author bnasslahsen
12+
*/
13+
@Component
14+
public class SpringWebConfig implements WebMvcConfigurer {
15+
16+
@Override
17+
public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
18+
converters.removeIf(c -> c instanceof StringHttpMessageConverter);
19+
}
20+
}

0 commit comments

Comments
 (0)