- Chapter
- Chapter 1 — Spring Boot Fundamentals
- Prerequisites
- Topics 1.1–1.2
- You will be able to
- Explain precisely how Boot relates to the Framework, contrast them across key dimensions, and decide when Boot is (or is not) the right choice
- Covers
- Relationship · Differences · When Boot Is Useful
On this page
- 1. Concept / Definition
- 2. Why It Exists
- 3. Core Concepts
- 4. How It Works Internally
- 4A. Deep Dive — Using Boot Features Without Full Boot Opinions
- 5. APIs / Features / Syntax
- 6. Practical Examples
- 7. Common Problems & Mistakes
- 8. Performance & Production Considerations
- 9. Architecture & Design Considerations
- 10. Interview Questions & Answers
1Concept / Definition
The Spring Framework is the programming model and container: dependency injection, AOP, transactions, data access, Spring MVC and WebFlux, events, and more. Spring Boot is an opinionated assembly and runtime layer for Spring applications: it chooses dependencies, configures infrastructure beans conditionally, embeds a server, externalizes configuration and adds production features.

| Statement | True? | Why |
|---|---|---|
| Boot replaces the Spring Framework | No | Every Boot application runs on the Framework's container |
| Boot adds a new programming model | No | Controllers, beans, @Transactional are Framework features |
| Boot can be used without the Framework | No | Boot depends on it |
| The Framework can be used without Boot | Yes | Libraries, legacy WARs, custom runtimes |
| Boot configures other Spring projects | Yes | Data, Security, Batch, Kafka, Integration… via auto-configuration |
2Why It Exists
As the Spring portfolio grew (Spring Data, Spring Security, Spring Batch, Spring Integration, Spring Cloud), integrating them correctly became a skill in itself. The Framework deliberately stays unopinionated — it must serve libraries, application servers and every kind of application. Boot was created as a separate project so that opinions about defaults, versions and packaging could evolve without constraining the Framework's generality. The two projects are released in coordinated generations: Boot 4 is built on Framework 7, Boot 3 on Framework 6.
3Core Concepts
3.1 Relationship
| Layer | Provides | Example |
|---|---|---|
| Java / Jakarta EE | Runtime and APIs | JVM, Servlet 6.1, JPA 3.2, Bean Validation |
| Spring Framework | Container and programming model | @Component, @Transactional, @RestController |
| Spring portfolio projects | Domain capabilities | Spring Data repositories, Spring Security filter chain |
| Spring Boot | Assembly, configuration, runtime, operations | Starters, auto-configuration, embedded Tomcat, Actuator |
Boot's auto-configuration calls the same Framework APIs you would call by hand — it creates a JpaTransactionManager, registers a DispatcherServlet, builds a SecurityFilterChain. Understanding the Framework (Volumes I–II) is therefore a prerequisite for understanding what Boot configures.
3.2 Differences

| Dimension | Spring Framework | Spring Boot |
|---|---|---|
| Purpose | Programming model and container | Opinionated application assembly and runtime |
| Configuration | Explicit (Java config, XML) | Auto-configuration + properties; explicit overrides |
| Dependencies | You choose libraries and versions | Starters + managed BOM |
| Server | Deploy WAR to external container (or embed yourself) | Embedded server, executable jar (WAR optional) |
| Configuration values | @PropertySource, Environment | Rich externalized configuration, relaxed binding, @ConfigurationProperties |
| Production features | Build your own | Actuator, Micrometer, probes, graceful shutdown |
| Testing | Spring TestContext | Plus test slices, @SpringBootTest, Testcontainers integration |
| Packaging and images | Standard Java tooling | Boot build plugins: executable/layered jars, buildpack images, AOT |
3.3 When Boot is useful

Boot is the default choice for applications: web services, APIs, event-driven workers, batch jobs, CLIs. Plain Framework remains appropriate for libraries (which must not impose Boot's opinions on consumers), for applications deployed into existing application servers where Boot's runtime adds nothing, and for highly specialised runtimes that need full control over assembly.
| Scenario | Recommendation |
|---|---|
| New REST microservice | Boot (spring-boot-starter-webmvc or -webflux) |
| Kafka consumer / scheduled worker | Boot with web-application-type: none |
| Reusable company library | Plain Spring (or no Spring); ship an optional Boot starter separately |
| Legacy WAR on WebLogic, gradually modernised | Boot WAR packaging or Framework only; plan migration |
| Serverless function with tight cold-start budget | Boot + AOT/native image, or Spring Cloud Function |
4How It Works Internally

The practical consequence of the layering is where to look when something breaks:
| Symptom | Likely layer | Where to look |
|---|---|---|
| Bean behaves wrongly (proxy, transaction, injection) | Framework | Volumes I–II concepts, Framework docs |
| Bean missing, duplicated or unexpectedly present | Boot auto-configuration | Condition report, /actuator/beans |
| Wrong property value used | Boot externalized configuration | /actuator/env, /actuator/configprops |
NoSuchMethodError after upgrade | Boot dependency management | dependency:tree, BOM alignment |
| Service not ready / killed by platform | Boot lifecycle + Actuator | Availability states, probes |
4ADeep Dive — Using Boot Features Without Full Boot Opinions
Boot is modular; you can adopt parts of it:
| Need | Option |
|---|---|
| Aligned versions only | Import spring-boot-dependencies BOM without Boot at runtime |
| Boot runtime but minimal auto-configuration | @ImportAutoConfiguration with an explicit list instead of @EnableAutoConfiguration |
| Boot in a WAR on an external server | Extend SpringBootServletInitializer; mark server starter as provided (spring-boot-starter-tomcat-runtime for Tomcat deployments in Boot 4) |
| Library that works with and without Boot | Core library with no Boot dependency + separate *-spring-boot-starter module |
| Upgrade path from Boot 3 | Classic starters (spring-boot-starter-classic) as a temporary bridge to Boot 4 modularity |
// A test or specialised runtime importing only selected auto-configurations
@Configuration
@ImportAutoConfiguration({
DataSourceAutoConfiguration.class, // imports from the Boot JDBC module
JdbcTemplateAutoConfiguration.class })
class MinimalJdbcConfig { }5APIs / Features / Syntax
| Framework-only mechanism | Boot counterpart |
|---|---|
AnnotationConfigApplicationContext | SpringApplication.run |
@PropertySource + Environment | application.yaml, profiles, @ConfigurationProperties |
Manual DataSource / EntityManagerFactory beans | JDBC / JPA auto-configuration + spring.datasource.*, spring.jpa.* |
WebApplicationInitializer + WAR | Embedded server + executable jar (or SpringBootServletInitializer) |
Spring TestContext (@ContextConfiguration) | @SpringBootTest, test slices, @ServiceConnection |
| Custom health/metrics endpoints | Actuator + Micrometer |
6Practical Examples
6.1 The same controller, two assemblies
// Identical in both worlds — the Framework programming model
@RestController
class PingController {
@GetMapping("/ping") String ping() { return "pong"; }
}// Plain Framework: you create and configure the web context yourself
public class WebInit extends AbstractAnnotationConfigDispatcherServletInitializer {
protected Class<?>[] getRootConfigClasses() {
return new Class<?>[] { RootConfig.class };
}
protected Class<?>[] getServletConfigClasses() {
return new Class<?>[] { WebConfig.class };
}
protected String[] getServletMappings() { return new String[] { "/" }; }
} // + @EnableWebMvc WebConfig, WAR packaging, external Tomcat
// Boot: one class, embedded server
@SpringBootApplication
public class PingApp {
public static void main(String[] a) { SpringApplication.run(PingApp.class, a); }
}6.2 A library with an optional Boot starter
acme-audit (plain Java/Spring library, no Boot)
acme-audit-spring-boot-autoconfigure (auto-configuration + properties)
acme-audit-spring-boot-starter (POM: library + autoconfigure)6.3 WAR deployment in Boot 4
@SpringBootApplication
public class LegacyApp extends SpringBootServletInitializer {
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder b) {
return b.sources(LegacyApp.class);
}
}6.4 Boot and Framework generations
| Spring Boot | Spring Framework | Jakarta EE | Minimum Java | Notable shift |
|---|---|---|---|---|
| 2.x | 5.x | Java EE 8 (javax.*) | 8 | Executable jars, Actuator 2, reactive stack |
| 3.x | 6.x | Jakarta EE 9/10 (jakarta.*) | 17 | Namespace change, AOT and native images, observability |
| 4.x | 7.x | Jakarta EE 11 (Servlet 6.1) | 17 | Modular auto-configuration, Jackson 3, JSpecify null-safety, core resilience features |
Each Boot generation fixes the Framework generation and the Jakarta EE baseline. Upgrading Boot therefore means upgrading the Framework and many third-party libraries together — which is exactly why Boot's managed versions are valuable.
6.5 Migration checklist from Boot 3 to Boot 4 (summary)
- Upgrade to the latest 3.5.x first and remove deprecated API usage.
- Replace renamed starters (
-web→-webmvc,-aop→-aspectj, OAuth2 starters under-security-oauth2-*) and add starters for technologies that previously had none (Flyway, Liquibase). - Add the
-testcompanion starters for tested technologies; replace@MockBeanwith@MockitoBean. - Migrate Jackson 2 customisations to Jackson 3 (
JsonMapper,tools.jacksonpackages). - Use
spring-boot-starter-classictemporarily if the modular split blocks progress; remove it afterwards. - Run with
spring-boot-properties-migratorto detect renamed properties.
7Common Problems & Mistakes
- Saying "Spring Boot transactions" or "Boot DI". They are Framework features; misattribution hides where behaviour is defined.
- Mixing Boot with manual infrastructure that duplicates auto-configured beans.
- Libraries depending on Boot starters. Forces versions and auto-configuration on consumers.
- Choosing plain Framework for new services "for control" and rebuilding what Boot already provides.
- Mismatched generations (Boot 4 with Framework 6 artefacts pinned manually).
These mistakes are easiest to spot through their symptoms. Duplicated infrastructure usually appears as two beans of the same type and a NoUniqueBeanDefinitionException at start-up or, worse, as a silent back-off where Boot's auto-configured DataSource or ObjectMapper disappears because a hand-written bean replaced it with fewer settings. The condition evaluation report, printed with --debug or exposed at /actuator/conditions, shows exactly which auto-configurations matched and which backed off. A copied @EnableWebMvc class is the classic case, switching off Boot's MVC customisations entirely. Generation mismatches show up as NoSuchMethodError or ClassNotFoundException on a code path that worked before an upgrade, typically after someone pinned a Framework or Jackson version manually; mvn dependency:tree or gradle dependencyInsight reveals the override. Rebuilding Boot by hand tends to be discovered late, when the first incident shows that the service has no health probes, no graceful shutdown and no consistent metrics. Treat every explicit version property and every infrastructure @Bean in a Boot application as something to justify in review.
8Performance & Production Considerations
| Aspect | Framework only | Boot |
|---|---|---|
| Start-up | Only what you configure | Auto-configuration evaluation adds some work; usually small |
| Footprint | Minimal if curated carefully | Starters may add unused libraries — trim them |
| Operations | Custom per application | Uniform health, metrics, logging, shutdown |
| Upgrades | Many independent version decisions | One coordinated Boot upgrade |
9Architecture & Design Considerations
- Standardise on Boot for applications, on plain Spring (or plain Java) for libraries.
- Know the generation pairs (Boot 4 ↔ Framework 7, Jakarta EE 11) and plan upgrades together.
- Layer internal platforms on Boot's extension points rather than forking or wrapping it.
- Train teams on the Framework first: Boot productivity without Framework understanding creates fragile systems.
10Interview Questions & Answers
What is the difference between Spring Framework and Spring Boot?
The Spring Framework is the programming model and container: dependency injection, AOP, transactions, data access, Spring MVC and WebFlux, events and the rest. Spring Boot is a separate project built on top of it that decides how an application is assembled and run. It chooses compatible dependency versions through starters and a managed BOM, creates infrastructure beans through conditional auto-configuration, embeds the server so the application runs as an executable jar, externalises configuration with profiles and @ConfigurationProperties, and adds production features through Actuator and Micrometer. Your controllers, @Transactional services and repositories are Framework code in both cases. In short, the Framework defines how components work; Boot defines how the application is put together.
Can you use Spring without Spring Boot?
Yes. Boot depends on the Framework, but the Framework has no dependency on Boot, and it was used for a decade before Boot existed. Without Boot you create the ApplicationContext yourself, for example with AnnotationConfigApplicationContext, declare infrastructure beans such as the DataSource, transaction manager and DispatcherServlet explicitly, choose and align library versions, typically through spring-framework-bom, and package a WAR for an external server or embed a server yourself. This is the right model for reusable libraries, for applications that live inside an existing application server, and for specialised runtimes. For new deployable services, though, it mostly means rebuilding by hand what Boot already provides, tests and maintains for you.
Does Boot change how @Transactional or dependency injection works?
No. Dependency injection, bean lifecycle, AOP proxies and transaction semantics are all implemented in the Framework, and they behave identically with or without Boot. What Boot changes is which infrastructure exists and how it is configured. For transactions, auto-configuration creates a JpaTransactionManager or DataSourceTransactionManager and enables transaction management, but propagation, rollback rules and the self-invocation limitation are unchanged. Boot does set a few defaults that look like behaviour changes, such as proxyTargetClass set to true so beans are proxied with CGLIB rather than JDK interface proxies, which affects whether injection by concrete class works. So when @Transactional misbehaves, read the Framework rules first and check Boot only for the configured manager.
When would you not use Spring Boot?
I would not use Boot for reusable libraries, because depending on starters forces Boot's versions and auto-configuration on every consumer; the library should depend on plain Spring, or nothing, and offer an optional starter. The second case is an application deployed into an existing application server that already provides the server, connection pools and operations tooling, where Boot's runtime adds little, although Boot can still be packaged as a WAR during a migration. The third is a specialised runtime or embedded use that needs full control over how the context is assembled. Even then, importing spring-boot-dependencies for version alignment is often worthwhile. For ordinary services, APIs, workers and batch jobs, Boot should be the default.
How do you provide Boot integration for a library without forcing Boot on its users?
Split the library into three artifacts, the same pattern Spring's own projects follow. The core library, for example acme-audit, depends only on plain Java or the Spring Framework and contains no Boot classes. An acme-audit-spring-boot-autoconfigure module holds auto-configuration classes registered in META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports, guarded with @ConditionalOnClass and @ConditionalOnMissingBean so users can override any bean, plus a @ConfigurationProperties class with metadata for IDE hints. Finally, acme-audit-spring-boot-starter is a POM that combines the two. Boot users add the starter and get sensible defaults; other users add the core library and wire it themselves, with no Boot JARs on their classpath at all.
How do you use Boot's dependency management without its runtime?
Import Boot's BOM, spring-boot-dependencies, without using SpringApplication or any starter. In Maven you add it under dependencyManagement with type pom and scope import, rather than inheriting spring-boot-starter-parent, so you get managed versions without Boot's plugin configuration. In Gradle you declare it as a platform dependency with the Boot version you target. You then declare spring-context, spring-jdbc, Jackson, Hibernate and other libraries without versions, and they resolve to the combination Boot has tested together. Nothing from Boot runs at runtime, because no Boot JAR is on the classpath. This suits libraries and non-Boot applications that want the same versions as the organisation's Boot services, and it eases a later migration.
Why is Framework knowledge essential for Boot developers?
Because Boot only configures Framework mechanisms; it does not replace them. When a transaction does not roll back, a bean is injected as null, an aspect is not applied or a controller method is never reached, the cause lies in proxying, bean lifecycle, transaction propagation or MVC dispatch, which are all Framework topics. Boot's condition report can tell you which beans were created, but not why a self-invoked @Transactional method runs without a transaction. Developers who learned only Boot tend to fix such problems by adding annotations until something works, which produces fragile systems. Teams that understand the Framework can read auto-configuration source, override it precisely and debug production incidents from first principles.
How would you define an organisation's policy on Boot versus plain Spring?
I would write it as a short standard with clear defaults and governed exceptions. Every deployable application uses Spring Boot on an approved release line, inherits a platform BOM and uses approved starters, including an internal starter for logging, observability and security conventions. Shared libraries depend on plain Spring or plain Java and ship optional Boot starters, never starters as hard dependencies. Legacy application-server deployments and specialised runtimes may use the Framework without Boot, but only through an architecture decision record with an owner and a review date. The policy also sets the upgrade cadence, for example adopting each new Boot minor release within six months, and is checked automatically in CI.
Test your knowledge on this topic →Flashcards from this topic's 8 questions, filtered by level and type.