# Spring vs Spring Boot: What Problem Does Boot Solve?

> What is the difference between Spring and Spring Boot, and why did Spring Boot become the default choice for new Java backends?

Canonical: https://www.internhack.in/learn/interview/spring-boot-interview/spring-vs-spring-boot
Last updated: 2026-11-28

Difficulty: Beginner

## Question

What is the difference between Spring and Spring Boot, and why did Spring Boot become the default choice for new Java backends?

## Answer

Let's start with the question that opens almost every Java interview in India, because a crisp answer here sets the tone for the next forty minutes. Spring Framework is a large toolkit built around one big idea: you should not create and wire your own objects, the container should do it for you. It gives you dependency injection, AOP, transaction management, Spring MVC for web, JDBC and ORM integration, and much more. Spring Boot is not a competitor to Spring. It is an opinionated layer on top that removes the setup pain of using Spring.

Think of Spring as a professional kitchen with every appliance available but nothing plugged in. Before cooking a single dish you have to choose a chef's knife, connect the gas, and decide the layout. Spring Boot is the same kitchen delivered with a ready meal kit: the appliances are already plugged in, sensible defaults are selected, and you can start cooking immediately. You can still rearrange anything, but you do not have to before serving your first customer.

In classic Spring, a web application needed a web.xml or a WebApplicationInitializer, a DispatcherServlet configuration, a view resolver, a data source bean, an entity manager factory, a transaction manager, and a WAR file deployed to an external Tomcat. Version compatibility between libraries was your problem too. Spring Boot fixes this with four things. First, starters, which are curated dependency bundles with tested versions. Second, auto-configuration, which looks at your classpath and creates beans for you. Third, an embedded server, so the application is a plain executable JAR started with java -jar. Fourth, production features such as Actuator, externalised configuration, and sensible logging defaults.

A very common trap is the claim that Boot replaces Spring. It does not. Under the hood your controllers, services, and transactions are still plain Spring features. If you understand the Spring core, Boot feels like magic that you can explain; if you skip the core, Boot feels like magic that you cannot debug. Interviewers at TCS or Infosys often follow up with what happens when auto-configuration does the wrong thing, and the answer is that you override it by defining your own bean, excluding the auto-configuration class, or setting a property.

Another point worth mentioning is convention over configuration. A property like server.port=9090 replaces a pile of XML. A spring-boot-starter-data-jpa dependency plus a database driver on the classpath is enough for Boot to create a DataSource, a JPA EntityManagerFactory, and a transaction manager, using the connection URL from your properties file. You write business code, not plumbing.

Finally, be honest about trade-offs. Boot hides a lot, which can make startup time and memory use harder to reason about, and the fat JAR is larger. For microservices and typical CRUD backends these costs are usually acceptable, which is why Boot dominates. In an interview, close with a one-line summary: Spring is the framework, Spring Boot is the fastest, most opinionated way to use it, with production-ready defaults out of the box.

## Code examples

### Smallest Spring Boot application

```
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@SpringBootApplication
@RestController
public class DemoApplication {

    @GetMapping("/hello")
    public String hello() {
        return "Hello from Spring Boot";
    }

    public static void main(String[] args) {
        SpringApplication.run(DemoApplication.class, args);
    }
}
```

No XML, no external Tomcat, no manual DispatcherServlet setup. The starter-web dependency plus this class is a complete web service.

## Key points

- Spring Boot does not replace Spring; it configures and packages it.
- Starters manage compatible dependency versions through the spring-boot-dependencies BOM.
- The default embedded server is Tomcat; Jetty and Undertow can be swapped in.
- Boot 3 requires Java 17 or higher and uses jakarta.\* packages instead of javax.\*.

## Common follow-up questions

- Can you build a Spring application without Spring Boot?
- How do you deploy a Spring Boot app as a WAR to an external server?
- What does spring-boot-starter-parent give you?

## Interview tips

- Say clearly that Boot is built on Spring rather than being an alternative to it.
- Mention at least three concrete pain points it removes: XML config, version conflicts, external server.

## Concepts covered

Spring Framework, Spring Boot, Auto-configuration, Embedded Server

Next: [Inversion of Control and Dependency Injection Explained](https://www.internhack.in/learn/interview/spring-boot-interview/spring-ioc-dependency-injection) · [All of Spring Boot](https://www.internhack.in/learn/interview/spring-boot-interview)

## More Spring Boot questions

- [Constructor vs Setter vs Field Injection](https://www.internhack.in/learn/interview/spring-boot-interview/spring-injection-types-constructor-preferred)
- [ApplicationContext vs BeanFactory](https://www.internhack.in/learn/interview/spring-boot-interview/spring-applicationcontext-vs-beanfactory)
- [Spring Bean Scopes and the Singleton Trap](https://www.internhack.in/learn/interview/spring-boot-interview/spring-bean-scopes)
- [Spring Bean Lifecycle Step by Step](https://www.internhack.in/learn/interview/spring-boot-interview/spring-bean-lifecycle)
- [@Component, @Service, @Repository and @Controller](https://www.internhack.in/learn/interview/spring-boot-interview/spring-stereotype-annotations)
- [@Autowired, @Qualifier and @Primary](https://www.internhack.in/learn/interview/spring-boot-interview/spring-autowired-qualifier-primary)

## Related

- [Learn](https://www.internhack.in/learn)
- [Interview Prep](https://www.internhack.in/learn/interview)
- [Spring Boot](https://www.internhack.in/learn/interview/spring-boot-interview)
