You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.1 KiB
33 lines
1.1 KiB
package com.example.demo.config;
|
|
|
|
import org.springframework.context.annotation.Bean;
|
|
import org.springframework.context.annotation.Configuration;
|
|
import org.springframework.http.converter.HttpMessageConverter;
|
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
|
import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer;
|
|
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
|
import java.nio.charset.StandardCharsets;
|
|
import java.util.List;
|
|
|
|
@Configuration
|
|
public class CustomMVCConfiguration implements WebMvcConfigurer {
|
|
|
|
|
|
@Bean
|
|
public HttpMessageConverter<String> responseBodyConverter() {
|
|
return new StringHttpMessageConverter(StandardCharsets.UTF_8);
|
|
}
|
|
|
|
@Override
|
|
public void configureMessageConverters(
|
|
List<HttpMessageConverter<?>> converters) {
|
|
converters.add(responseBodyConverter());
|
|
}
|
|
|
|
@Override
|
|
public void configureContentNegotiation(
|
|
ContentNegotiationConfigurer configurer) {
|
|
configurer.favorPathExtension(false);
|
|
}
|
|
}
|
|
|