当我们通过spring boot 仅运行一些定时任务时,就可以不用占用web启动端口,这时候就需要spring boot 不占用web端口的方式;
springboot 2.x之后(代码方式)
@SpringBootApplication
public class MyApplication {
public static void main(String[] args) {
new SpringApplicationBuilder(MyApplication.class)
.web(WebApplicationType.NONE) // .REACTIVE, .SERVLET
.run(args);
}
}
springboot 2.x之后(配置方式)
spring.main.web-application-type=none
参考:https://www.cnblogs.com/angryprogrammer/p/11757302.html
标签:web,方式,spring,占用,boot,端口 From: https://www.cnblogs.com/hungryquiter/p/16972934.html