AppRun.java 1.3 KB
Newer Older
郑杰 已提交
1 2
package me.zhengjie;

3
import me.zhengjie.utils.SpringContextHolder;
郑杰 已提交
4 5
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
6 7 8
import org.springframework.boot.web.embedded.tomcat.TomcatConnectorCustomizer;
import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
9
import org.springframework.context.annotation.Bean;
10
import org.springframework.scheduling.annotation.EnableAsync;
11
import org.springframework.transaction.annotation.EnableTransactionManagement;
郑杰 已提交
12 13

/**
14
 * @author Zheng Jie
郑杰 已提交
15 16
 * @date 2018/11/15 9:20:19
 */
17
@EnableAsync
郑杰 已提交
18
@SpringBootApplication
19
@EnableTransactionManagement
郑杰 已提交
20 21 22 23 24
public class AppRun {

    public static void main(String[] args) {
        SpringApplication.run(AppRun.class, args);
    }
25 26 27 28 29

    @Bean
    public SpringContextHolder springContextHolder() {
        return new SpringContextHolder();
    }
30 31 32 33 34 35 36

    @Bean
    public ServletWebServerFactory webServerFactory() {
        TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
        fa.addConnectorCustomizers((TomcatConnectorCustomizer) connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
        return fa;
    }
郑杰 已提交
37
}