SvrBaseApplication.java 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. package com.yihu;
  2. import org.springframework.boot.SpringApplication;
  3. import org.springframework.boot.autoconfigure.SpringBootApplication;
  4. import org.springframework.boot.builder.SpringApplicationBuilder;
  5. import org.springframework.boot.web.servlet.MultipartConfigFactory;
  6. import org.springframework.boot.web.support.SpringBootServletInitializer;
  7. import org.springframework.context.annotation.Bean;
  8. import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
  9. import org.springframework.scheduling.annotation.EnableAsync;
  10. import javax.servlet.MultipartConfigElement;
  11. /**
  12. * Created by chenweida on 2017/5/10.
  13. * localhost:10020/refresh 刷新当个微服务的配置 可以在需要刷新的bean上面@RefreshScope
  14. */
  15. @SpringBootApplication
  16. @EnableJpaAuditing
  17. @EnableAsync
  18. public class SvrBaseApplication extends SpringBootServletInitializer {
  19. public static void main(String[] args) {
  20. SpringApplication.run(SvrBaseApplication.class, args);
  21. }
  22. @Override
  23. protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
  24. return builder.sources(SvrBaseApplication.class);
  25. }
  26. @Bean
  27. MultipartConfigElement multipartConfigElement() {
  28. MultipartConfigFactory factory = new MultipartConfigFactory();
  29. factory.setLocation("/home/temp");
  30. return factory.createMultipartConfig();
  31. }
  32. }