How to prevent auto start of tomcat/jetty in Spring Boot when I only want to use RestTemplate

前端 未结 3 2054
时光取名叫无心
时光取名叫无心 2021-02-05 05:57

I want to use RestTemplate/TestRestTemplate by including the artifact in a SpringBoot application

    
        org.springframewo         


        
3条回答
  •  南方客
    南方客 (楼主)
    2021-02-05 06:31

    You can just close the app according to https://spring.io/guides/gs/async-method/. Although this still stars Tomcat, but will stop the app at the end without keeping the tread running.

    SpringApplication.run(MyApp.class, args).close();
    

提交回复
热议问题