解除上传限制

This commit is contained in:
wangxulei 2024-12-19 19:35:40 +08:00
parent 74703e2719
commit cd5e139043
4 changed files with 29 additions and 7 deletions

View File

@ -44,11 +44,6 @@ public class ApiController {
@GetMapping("/api/notes")
@OperLog(operModule = "获取所有笔记",operType = OperType.QUERY,operDesc = "获取所有笔记")
public ResultBean<IPage<NoteVo>> page(NoteDto noteDto) {
try {
Thread.sleep(300);
} catch (InterruptedException e) {
e.printStackTrace();
}
IPage<NoteVo> pageInfo = noteService.selectNotePage(noteDto);
return ResultBean.success(pageInfo);
}

View File

@ -60,6 +60,7 @@ public class CorsConfig implements WebMvcConfigurer {
// @Bean
// public MappingJackson2HttpMessageConverter getMappingJackson2HttpMessageConverter() {
// MappingJackson2HttpMessageConverter mappingJackson2HttpMessageConverter = new MappingJackson2HttpMessageConverter();

View File

@ -0,0 +1,21 @@
package com.dd.admin.common.config;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.util.unit.DataSize;
import javax.servlet.MultipartConfigElement;
@Configuration
public class FileUploadConfig {
@Bean
public MultipartConfigElement multipartConfigElement() {
MultipartConfigFactory factory = new MultipartConfigFactory();
// 单个数据大小
factory.setMaxFileSize(DataSize.parse("20480KB")); // KB,MB 20480KB=20M
// 总上传数据大小
factory.setMaxRequestSize(DataSize.parse("102400KB")); //102400KB=100M
return factory.createMultipartConfig();
}
}

View File

@ -2,8 +2,8 @@ spring:
servlet:
multipart:
enabled: true #默认支持文件上传
max-file-size: 50MB #不做限制
max-request-size: 50MB #不做限制
max-file-size: -1 #不做限制
max-request-size: 1 #不做限制
datasource:
driver-class-name: com.p6spy.engine.spy.P6SpyDriver
@ -54,3 +54,8 @@ mybatis-plus:
server:
port: 8080
# tomcat:
# max-swallow-size: -1
# max-http-form-post-size: 52428800
# servlet:
# max-http-post-size: 52428800