fixed default controller, fixed post methods
This commit is contained in:
parent
6bc177d506
commit
0170065ddb
3 changed files with 10 additions and 3 deletions
|
|
@ -7,10 +7,12 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerF
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.http.converter.HttpMessageConverter;
|
import org.springframework.http.converter.HttpMessageConverter;
|
||||||
|
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||||
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
|
||||||
import org.springframework.web.servlet.config.annotation.*;
|
import org.springframework.web.servlet.config.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
@SuppressWarnings("Duplicates")
|
@SuppressWarnings("Duplicates")
|
||||||
@Configuration
|
@Configuration
|
||||||
|
|
@ -31,7 +33,12 @@ public class WebConfig implements WebMvcConfigurer {
|
||||||
@Autowired
|
@Autowired
|
||||||
@Override
|
@Override
|
||||||
public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
|
public void configureMessageConverters(List<HttpMessageConverter<?>> messageConverters) {
|
||||||
messageConverters.add(customJsonHttpConverter);
|
Consumer<HttpMessageConverter<?>> addConverter = httpMessageConverter -> {
|
||||||
|
messageConverters.removeIf(registeredConverter -> registeredConverter.getClass().equals(httpMessageConverter.getClass()));
|
||||||
|
messageConverters.add(httpMessageConverter);
|
||||||
|
};
|
||||||
|
addConverter.accept(new StringHttpMessageConverter());
|
||||||
|
addConverter.accept(customJsonHttpConverter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class CudMoneyMarketSecurityController extends AbstractQueueController {
|
||||||
|
|
||||||
@ApiOperation(value = "create money security.")
|
@ApiOperation(value = "create money security.")
|
||||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
@RequestMapping(value = "/", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CudResponse add(
|
public CudResponse add(
|
||||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ public class CudKeyRateController extends AbstractQueueController {
|
||||||
|
|
||||||
@ApiOperation(value = "create key rate.")
|
@ApiOperation(value = "create key rate.")
|
||||||
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
@ApiResponses(value = {@ApiResponse(code = 200, message = "OK", response = CudResponse.class), @ApiResponse(code = 400, message = "Ошибка валидации", response = BasicSpcexResponse.class)})
|
||||||
@RequestMapping(value = "/", method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
|
@RequestMapping(method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public CudResponse add(
|
public CudResponse add(
|
||||||
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
@ApiParam(value = "Параметры команды в JSON формате.", required = true)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue