123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778 |
- package com.ygj.yuemum;
- import com.github.pagehelper.PageHelper;
- import org.mybatis.spring.annotation.MapperScan;
- import org.springframework.boot.SpringApplication;
- import org.springframework.boot.autoconfigure.SpringBootApplication;
- import org.springframework.boot.builder.SpringApplicationBuilder;
- import org.springframework.boot.web.servlet.MultipartConfigFactory;
- import org.springframework.boot.web.support.SpringBootServletInitializer;
- import org.springframework.context.annotation.Bean;
- import org.springframework.scheduling.annotation.EnableScheduling;
- import org.springframework.web.WebApplicationInitializer;
- import javax.servlet.MultipartConfigElement;
- import java.util.Properties;
- @SpringBootApplication
- @MapperScan("com.ygj.yuemum.dao")
- @EnableScheduling
- public class YueMumApplication {
- public static void main(String[] args) {
- SpringApplication.run(YueMumApplication.class, args);
- }
- @Bean
- public PageHelper pageHelper() {
- PageHelper pageHelper = new PageHelper();
- Properties properties = new Properties();
- properties.setProperty("offsetAsPageNum", "true");
- properties.setProperty("rowBoundsWithCount", "true");
- properties.setProperty("reasonable", "true");
- properties.setProperty("dialect", "mysql"); //配置mysql数据库的方言
- pageHelper.setProperties(properties);
- return pageHelper;
- }
- @Bean
- public MultipartConfigElement multipartConfigElement() {
- MultipartConfigFactory factory = new MultipartConfigFactory();
- // 单个数据大小
- factory.setMaxFileSize("50240KB");
- /// 总上传数据大小
- factory.setMaxRequestSize("50240KB");
- return factory.createMultipartConfig();
- }
- }
- //public class YueMumApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
- //
- // @Override
- // protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
- //
- // return application.sources(YueMumApplication.class);
- // }
- //
- // public static void main(String[] args) {
- // SpringApplication.run(YueMumApplication.class, args);
- // }
- // @Bean
- // public PageHelper pageHelper() {
- // PageHelper pageHelper = new PageHelper();
- // Properties properties = new Properties();
- // properties.setProperty("offsetAsPageNum", "true");
- // properties.setProperty("rowBoundsWithCount", "true");
- // properties.setProperty("reasonable", "true");
- // properties.setProperty("dialect", "mysql"); //配置mysql数据库的方言
- // pageHelper.setProperties(properties);
- // return pageHelper;
- // }
- // @Bean
- // public MultipartConfigElement multipartConfigElement() {
- // MultipartConfigFactory factory = new MultipartConfigFactory();
- // // 单个数据大小
- // factory.setMaxFileSize("10240KB");
- // /// 总上传数据大小
- // factory.setMaxRequestSize("10240KB");
- // return factory.createMultipartConfig();
- // }
- //}
|