package com.fzm.mall.server.front;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.MultipartConfigFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.util.unit.DataSize;

import javax.servlet.MultipartConfigElement;

@EnableScheduling
@MapperScan("com.fzm.mall.server.front.*.mapper")
@SpringBootApplication(scanBasePackages = "com.fzm.mall")
public class MallServerFrontApplication {

	public static void main(String[] args) {
		try	{
		SpringApplication.run(MallServerFrontApplication.class, args);
		}catch (Exception e){
			System.out.println("ssssssssssssssssssssss"+e.toString());
		}
	}

	@Bean
	public MultipartConfigElement multipartConfigElement() {
		MultipartConfigFactory factory = new MultipartConfigFactory();
		//允许上传的文件最大值
		factory.setMaxFileSize(DataSize.parse("50MB")); //KB,MB
		/// 设置总上传数据总大小
		factory.setMaxRequestSize(DataSize.parse("50MB"));
		return factory.createMultipartConfig();
	}

}
