一、Spring Boot修改最大上传文件限制
报错信息: The field file exceeds its maximum permitted size of 1048576 bytes. SpringBoot默认配置: 每个文件的配置最大为1Mb,单次请求的文件的总数不能大于10Mb。 配置方法:
# Spring Boot 1.3.x或者之前
multipart.maxFileSize=100Mb
multipart.maxRequestSize=1000Mb
# Spring Boot 1.4.x
spring.http.multipart.maxFileSize=100Mb
spring.http.multipart.maxRequestSize=1000Mb
# Spring Boot 2.0之后
spring.servlet.multipart.max-file-size=100MB
spring.servlet.multipart.max-request-size=1000MB
二、mysql数据源配置
报错信息: Unknown initial character set index ‘255’ received from server. Initial client character set can be forced via the ‘characterEncoding’ property. 配置方法: 在url后拼接?useUnicode=true&characterEncoding=utf8
# mysql
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC
spring.datasource.username=root
spring.datasource.password=root