微调
This commit is contained in:
@@ -1,26 +0,0 @@
|
||||
package com.njcn.gather.system.config;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.njcn.common.bean.CustomCacheUtil;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-24
|
||||
*/
|
||||
@Configuration
|
||||
public class CustomCacheConfig {
|
||||
|
||||
/**
|
||||
* 将自定缓存工具类注入到spring容器中
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public CustomCacheUtil customCacheUtil() {
|
||||
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
||||
return customCacheUtil;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.gather.system.config;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.njcn.common.bean.CustomCacheUtil;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @author caozehui
|
||||
* @data 2025-03-24
|
||||
*/
|
||||
@Configuration
|
||||
public class WebConfig {
|
||||
|
||||
/**
|
||||
* 将自定缓存工具类注入到spring容器中
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public CustomCacheUtil customCacheUtil() {
|
||||
CustomCacheUtil customCacheUtil = SpringUtil.getBean(CustomCacheUtil.CACHE_NAME);
|
||||
return customCacheUtil;
|
||||
}
|
||||
|
||||
/**
|
||||
* 配置上传文件大小限制
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Bean
|
||||
public MultipartConfigElement multipartConfigElement() {
|
||||
MultipartConfigFactory factory = new MultipartConfigFactory();
|
||||
// 单个文件最大6MB
|
||||
factory.setMaxFileSize(DataSize.ofMegabytes(6));
|
||||
// 整个请求最大12MB
|
||||
factory.setMaxRequestSize(DataSize.ofMegabytes(12));
|
||||
return factory.createMultipartConfig();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user