编辑应用启动类 Application.java
package com.anydong.example.springboot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import javax.annotation.PostConstruct;
import java.util.TimeZone;
/**
* Application
*
* @author Where
* @date 2019/10/31
*/
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
/**
* 设置默认时区为:Asia/Shanghai
* 设置 URL 中可传入的特殊字符
*/
@PostConstruct
public void init() {
TimeZone.setDefault(TimeZone.getTimeZone("Asia/Shanghai"));
System.setProperty("tomcat.util.http.parser.HttpParser.requestTargetAllow", "|{}");
}
}