Question: 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 Spring Boot without the web server?

Answer: 
if you want to run **Spring Boot 1.x** without a servlet container, but with one on the classpath (e.g. for tests), use the following, as described in the [spring boot documentation](https://docs.spring.io/spring-boot/docs/1.5.x/reference/htmlsingle/#boot-features-web-environment):

```
@Configuration
@EnableAutoConfiguration
public class MyClass {
    public static void main(String[] args) throws JAXBException {
         SpringApplication app = new SpringApplication(MyClass.class);
         app.setWebEnvironment(false); //<<<<<<<<<
         ConfigurableApplicationContext ctx = app.run(args);
    }
}

```

also, I just stumbled across this property:

```
spring.main.web-environment=false

```
* Through program :

```
ConfigurableApplicationContext ctx =  new  SpringApplicationBuilder(YourApplicationMain.class)
.web(WebApplicationType.NONE)
.run(args);

```
* Through application.properties file :

```
spring.main.web-environment=false 

```
* Through application.yml file :

```
spring:
 main:
  web-environment:false

```