Can we create a non-web application in Spring Boot?

Yes, Spring Boot can be used to build non-web applications. Although it is widely known for developing web applications and REST APIs, it also supports standalone applications such as batch jobs, command-line tools, schedulers, data-processing programs, messaging consumers, and microservice workers. In a non-web application, Spring Boot starts the Spring container without launching an embedded web server.

Key Points

Example

Suppose a company needs a nightly job that reads data from a file, processes it, and stores the results in a database. This can be implemented as a Spring Boot non-web application running on a schedule without exposing any REST endpoints.

@SpringBootApplication
public class DataProcessorApplication
        implements CommandLineRunner {

    public static void main(
            String[] args) {

        SpringApplication.run(
                DataProcessorApplication.class,
                args);
    }

    @Override
    public void run(String... args)
            throws Exception {

        System.out.println(
                "Processing data...");
    }
}

Disable Web Server

application.properties

spring.main.web-application-type=none

Common Non-Web Use Cases

Runner Interfaces

1. CommandLineRunner

2. ApplicationRunner

Example

@Component
public class StartupRunner
        implements ApplicationRunner {

    @Override
    public void run(
            ApplicationArguments args) {

        System.out.println(
                "Application Started");
    }
}

Benefits

Real-World Example

A banking system may use a Spring Boot non-web application to

No web server is required because the application runs as a background process.

Interview Tip

A concise interview answer is: Yes, Spring Boot can be used to build non-web applications such as batch jobs, schedulers, command-line tools, and message consumers. By setting spring.main.web-application-type=none and using CommandLineRunner or ApplicationRunner, Spring Boot starts the application without launching an embedded web server while still providing all core Spring features.

Last updated: 16 July 2026

Previous question: How would you manage externalized configuration and secure sensitive properties in a microservices architecture?

Next question: How does Spring Boot support internationalization (i18n)?

More Spring Boot - Level II interview questions

All Spring Boot - Level II questions