@EnableScheduling
@SpringBootApplication
public class Application {

    public static void main(String[] args) {
        new SpringApplicationBuilder().sources(Application.class).web(false).run(args);
    }
}

 

Starting from Spring Boot 2.0

-web(false)/setWebEnvironment(false) is deprecated and instead Web-Application-Type can be used to specify

spring.main.web-application-type=NONE
@SpringBootApplication
public class SpringBootDisableWebEnvironmentApplication {

    public static void main(String[] args) {
        new SpringApplicationBuilder(SpringBootDisableWebEnvironmentApplication .class)
            .web(WebApplicationType.NONE) // .REACTIVE, .SERVLET
            .run(args);
   }
}

 

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-09-11
  • 2022-12-23
  • 2021-12-11
  • 2021-04-10
  • 2021-11-23
  • 2021-04-26
猜你喜欢
  • 2022-01-09
  • 2021-12-03
  • 2021-11-29
  • 2021-09-05
  • 2022-12-23
  • 2021-11-17
  • 2021-10-28
相关资源
相似解决方案