【发布时间】:2018-08-17 13:04:08
【问题描述】:
我已经在 application.yml 中设置了这些参数:
spring:
servlet:
multipart:
max-file-size: -1
max-request-size: -1
当我从 IDE 运行它时,它工作正常。当我尝试将它与 spring cloud、netflix eureka 和 zuul proxy 一起运行时,问题就开始了。它的行为就像没有这样的参数。它总是抛出:
"超出最大上传大小;嵌套异常是 java.lang.IllegalStateException: org.apache.tomcat.util.http.fileupload.FileUploadBase$FileSizeLimitExceededException: 字段文件超出了其允许的最大大小 1048576 字节。",
我应该把它放在别的地方吗?
编辑: 我的 bootstrap.yml
spring:
profiles: docker
application:
name: test-service
sleuth:
sampler:
probability: 1
zipkin:
base-url: http://zipkin:9411/
cloud:
config:
discovery:
enabled: true
service-id: config-server
fail-fast: true
retry:
initial-interval: 2000
max-interval: 10000
multiplier: 2
max-attempts: 10
eureka:
instance:
hostname: test-service
prefer-ip-address: true
client:
registerWithEureka: true
fetchRegistry: true
serviceUrl:
defaultZone: http://eureka-server:8761/eureka/
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
logging:
file: ./logs/log.log
【问题讨论】:
-
你也有 bootstrap.yml 吗?
-
在我看来是不同版本的 Spring Boot 的类路径问题。1) 检查您的 Spring Cloud 依赖项版本,它们可能引入了旧版本的 Spring Boot。 2)检查你的spring cloud版本是否与spring boot 2兼容
-
如果你使用 maven 作为构建系统,你可以使用 mvn dependency:tree 命令来查看你的有效 pom
-
@Arnaud 我已经用 bootstrap.yml 更新了我的帖子
-
@AnilBachola Spring boot 有 2.0.4 版本,cloud 是 Finchley.RELEASE
标签: java microservices spring-cloud netflix-zuul netflix-eureka