问题:springcloud gateway 框架做的一个项目,接口再请求时,出现上传数据小不会抛出问题,一旦请求报文数据大就会抛出问题

2020-02-26 21:16:26.540 ERROR 8 --- [reactor-http-epoll-78] o.s.c.g.h.RoutePredicateHandlerMapping   : Error applying predicate for route: 8e9a9879-83ff-4abd-8308-ec5956194b7a

org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
at org.springframework.core.io.buffer.LimitedDataBufferList.raiseLimitException(LimitedDataBufferList.java:101) ~[spring-core-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
at org.springframework.core.io.buffer.LimitedDataBufferList.updateCount(LimitedDataBufferList.java:94) ~[spring-core-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
at org.springframework.core.io.buffer.LimitedDataBufferList.add(LimitedDataBufferList.java:59) ~[spring-core-5.2.1.RELEASE.jar!/:5.2.1.RELEASE]
at reactor.core.publisher.MonoCollect$CollectSubscriber.onNext(MonoCollect.java:119) [reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.Operators$MonoSubscriber.complete(Operators.java:1592) ~[reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.FluxCallable.subscribe(FluxCallable.java:49) ~[reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.InternalMonoOperator.subscribe(InternalMonoOperator.java:55) ~[reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.MonoFlatMap$FlatMapMain.onNext(MonoFlatMap.java:150) ~[reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.FluxSwitchIfEmpty$SwitchIfEmptySubscriber.onNext(FluxSwitchIfEmpty.java:67) ~[reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.publisher.FluxMa

找了好多资料,尝试了很多方法,也更改配置了

spring:
  codec:
    max-in-memory-size: 50MB

然而并没有什么卵用

解决方式:我原来是从springboot2.2.0升级到springboot2.2.1,降回去就好了,亲测有效,没有再出现上边的问题

<parent>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-parent</artifactId>
	<version>2.2.0.RELEASE</version>
	<relativePath/> <!-- lookup parent from repository -->
</parent>

 

Logo

权威|前沿|技术|干货|国内首个API全生命周期开发者社区

更多推荐