use of org.springframework.boot.web.codec.CodecCustomizer in project spring-boot by spring-projects.
the class CodecsAutoConfigurationTests method autoConfigShouldProvideALoggingRequestDetailsCustomizer.
@Test
void autoConfigShouldProvideALoggingRequestDetailsCustomizer() {
this.contextRunner.run((context) -> {
CodecCustomizer customizer = context.getBean(CodecCustomizer.class);
CodecConfigurer configurer = new DefaultClientCodecConfigurer();
customizer.customize(configurer);
assertThat(configurer.defaultCodecs()).hasFieldOrPropertyWithValue("enableLoggingRequestDetails", false);
});
}
use of org.springframework.boot.web.codec.CodecCustomizer in project spring-boot by spring-projects.
the class ReactiveMultipartAutoConfiguration method defaultPartHttpMessageReaderCustomizer.
@Bean
@Order(0)
CodecCustomizer defaultPartHttpMessageReaderCustomizer(ReactiveMultipartProperties multipartProperties) {
return (configurer) -> configurer.defaultCodecs().configureDefaultCodec((codec) -> {
if (codec instanceof DefaultPartHttpMessageReader) {
DefaultPartHttpMessageReader defaultPartHttpMessageReader = (DefaultPartHttpMessageReader) codec;
PropertyMapper map = PropertyMapper.get().alwaysApplyingWhenNonNull();
map.from(multipartProperties::getMaxInMemorySize).asInt(DataSize::toBytes).to(defaultPartHttpMessageReader::setMaxInMemorySize);
map.from(multipartProperties::getMaxHeadersSize).asInt(DataSize::toBytes).to(defaultPartHttpMessageReader::setMaxHeadersSize);
map.from(multipartProperties::getMaxDiskUsagePerPart).asInt(DataSize::toBytes).to(defaultPartHttpMessageReader::setMaxDiskUsagePerPart);
map.from(multipartProperties::getMaxParts).to(defaultPartHttpMessageReader::setMaxParts);
map.from(multipartProperties::getStreaming).to(defaultPartHttpMessageReader::setStreaming);
map.from(multipartProperties::getFileStorageDirectory).as(Paths::get).to((dir) -> configureFileStorageDirectory(defaultPartHttpMessageReader, dir));
map.from(multipartProperties::getHeadersCharset).to(defaultPartHttpMessageReader::setHeadersCharset);
}
});
}
Aggregations