Spring Boot without the web server

后端 未结 16 814
眼角桃花
眼角桃花 2020-11-29 16:50

I have a simple Spring Boot application that gets messages from a JMS queue and saves some data to a log file, but does not need a web server. Is there any way of starting S

16条回答
  •  长情又很酷
    2020-11-29 17:14

    If you want to use one of the "Getting Started" templates from spring.io site, but you don't need any of the servlet-related stuff that comes with the "default" ("gs/spring-boot") template, you can try the scheduling-tasks template (whose pom* contains spring-boot-starter etc) instead:

    https://spring.io/guides/gs/scheduling-tasks/

    That gives you Spring Boot, and the app runs as a standalone (no servlets or spring-webmvc etc are included in the pom). Which is what you wanted (though you may need to add some JMS-specific stuff, as someone else points out already).

    [* I'm using Maven, but assume that a Gradle build will work similarly].

提交回复
热议问题