fix
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package ru.mtusi.messenger.config;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.jackson.autoconfigure.JsonMapperBuilderCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import tools.jackson.databind.DeserializationFeature;
|
||||
import tools.jackson.databind.cfg.CoercionAction;
|
||||
import tools.jackson.databind.cfg.CoercionInputShape;
|
||||
|
||||
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class JacksonConfig {
|
||||
|
||||
@Bean
|
||||
public JsonMapperBuilderCustomizer strictJacksonCustomizer() {
|
||||
log.warn(">>> Strict JsonMapper customizer applied");
|
||||
return builder -> builder
|
||||
.enable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)
|
||||
.withCoercionConfigDefaults(config -> {
|
||||
config.setCoercion(CoercionInputShape.Integer, CoercionAction.Fail);
|
||||
config.setCoercion(CoercionInputShape.Float, CoercionAction.Fail);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user