DataBufferLimitException: Exceeded limit on max bytes to buffer webflux error

前端 未结 5 840
悲哀的现实
悲哀的现实 2021-01-01 15:29

While sending a file I receive an array of bytes. I always have a problem with webflux to receive an array. the error thrown as below :

org.springframework.co         


        
5条回答
  •  一整个雨季
    2021-01-01 15:56

    i was getting this error for a simple RestController (i post a large json string).

    here is how i successfully changed the maxInMemorySize

    import org.springframework.context.annotation.Configuration;
    import org.springframework.http.codec.ServerCodecConfigurer;
    import org.springframework.web.reactive.config.ResourceHandlerRegistry;
    import org.springframework.web.reactive.config.WebFluxConfigurer;
    
    @Configuration
    public class WebfluxConfig implements WebFluxConfigurer {
    
        @Override
        public void addResourceHandlers(ResourceHandlerRegistry registry) {
    
            registry.addResourceHandler("/swagger-ui.html**")
                .addResourceLocations("classpath:/META-INF/resources/");
    
            registry.addResourceHandler("/webjars/**")
                .addResourceLocations("classpath:/META-INF/resources/webjars/");
        }
    
        @Override
        public void configureHttpMessageCodecs(ServerCodecConfigurer configurer) {
            configurer.defaultCodecs().maxInMemorySize(16 * 1024 * 1024);
        }
    }
    

    this was surprisingly hard to find

提交回复
热议问题