Interview questions · Tech stack

Spring Boot Interview Questions & Answers (2026)

These interviews test your grasp of Spring Boot's auto‑configuration, starter dependencies, embedded servers, and production‑ready features. Demonstrate clear understanding of the framework's conventions, how to customize beans, and performance tuning. Show practical examples, explain trade‑offs, and relate concepts to real‑world microservice architectures to impress interviewers.

21 questions · updated Aug 29, 2026

Quick facts

Typical roundsPhone screen, coding test, system design, deep‑dive Spring Boot interview
Core topicsAuto‑configuration, starters, Actuator, testing, security, deployment
Preferred experience2‑5 years with Spring Boot, REST APIs, and Maven/Gradle builds

Questions

Beginner

What is Spring Boot and why would you use it instead of plain Spring?

Spring Boot is a convention‑over‑configuration framework that simplifies Spring application setup by providing opinionated defaults, embedded servlet containers, and starter POMs. It eliminates boilerplate XML, auto‑configures beans based on classpath contents, and enables rapid prototyping. Interviewers expect you to stress reduced setup time, production‑ready defaults, and the ability to focus on business logic rather than infrastructure code.

GoogleAmazonMicrosoft

How does Spring Boot’s auto‑configuration work?

Auto‑configuration scans the classpath for specific libraries and beans, then conditionally creates @Bean definitions using @Conditional annotations. For example, if HikariCP is present, Spring Boot configures a DataSource automatically. The mechanism relies on @EnableAutoConfiguration and META‑INF/spring.factories entries. Interviewers look for an explanation of the conditional logic, the role of @ConditionalOnClass, @ConditionalOnMissingBean, and how you can disable it with @SpringBootApplication(exclude = …).

Netflix

What are Spring Boot starters and how do they simplify dependency management?

Starters are curated dependency descriptors that aggregate common libraries for a specific purpose, such as spring-boot-starter-web for MVC, Jackson, and Tomcat. By adding a single starter, Maven or Gradle pulls in compatible versions, reducing version conflicts and boilerplate pom entries. Interviewers expect you to mention that starters promote consistency across teams and enable quick feature toggling without manual dependency resolution.

Adobe

Explain the purpose of @SpringBootApplication annotation.

@SpringBootApplication combines @Configuration, @EnableAutoConfiguration, and @ComponentScan. It marks the main class, triggers auto‑configuration, and scans the package hierarchy for @Component, @Service, and @Repository beans. Interviewers want to see that you understand each meta‑annotation’s role, how component scanning can be limited with basePackages, and that the annotation is the entry point for a Spring Boot app.

IBM

How do you run a Spring Boot application from the command line?

You can run a Spring Boot jar with java -jar target/app.jar after building with Maven or Gradle. The jar contains an embedded server (Tomcat, Jetty, or Undertow) and a main method generated by SpringBootServletInitializer. Alternatively, use mvn spring-boot:run for development. Interviewers look for awareness of executable jars, the need for a main class with SpringApplication.run, and how profiles can be activated via –Dspring.profiles.active.

Oracle

What is the Spring Boot Actuator and which endpoints are most useful in production?

Actuator adds production‑ready features via HTTP endpoints that expose health, metrics, info, and env data. Commonly used endpoints are /actuator/health for liveness/readiness checks, /actuator/metrics for performance counters, and /actuator/loggers for dynamic log level changes. Interviewers expect you to discuss security of these endpoints, how to enable/disable them in application.yml, and their role in observability pipelines.

Spotify

Intermediate

How can you customize the embedded Tomcat server in Spring Boot?

You can customize Tomcat by defining a bean of type TomcatServletWebServerFactory and overriding its connectors, SSL settings, or thread pool. For example, set the port with server.port in properties, or programmatically add an additional connector for HTTP‑to‑HTTPS redirection. Interviewers look for code snippets, awareness of bean ordering, and the impact on startup time and resource usage.

public TomcatServletWebServerFactory servletContainer() { TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(); factory.setPort(8081); factory.addConnectorCustomizers(connector -> connector.setSecure(true)); return factory; }
PayPal

What is the difference between @Component, @Service, and @Repository annotations?

@Component is a generic stereotype for any Spring-managed bean. @Service indicates a service‑layer component and may carry additional semantics for tooling. @Repository marks a DAO component and enables exception translation from persistence exceptions to Spring’s DataAccessException hierarchy. Interviewers expect you to explain that all three are detected by component scanning, but @Repository adds AOP advice for persistence error handling.

Shopify

How does Spring Boot support externalized configuration and what are the precedence rules?

Spring Boot loads properties from application.yml/application.properties, profile‑specific files, environment variables, command‑line arguments, and system properties. The order of precedence is: command‑line args > Java system properties > OS env vars > profile‑specific files > default application files. Interviewers want you to mention @ConfigurationProperties binding, relaxed binding rules, and how to override defaults without changing code.

Twitter

Explain how to enable and use Spring Boot’s devtools for hot reload.

Add spring-boot-devtools as a development‑only dependency. It monitors classpath changes and restarts the application context automatically, preserving static resources. The restart classloader isolates user classes, allowing rapid feedback. Interviewers look for knowledge of automatic restart vs live reload, the need to disable devtools in production, and how to configure restart.exclude for large libraries.

Airbnb

What is the purpose of @ConfigurationProperties and how does it differ from @Value?

@ConfigurationProperties binds a group of related properties to a POJO, supporting type‑safe conversion, nested structures, and validation via JSR‑303. @Value injects a single expression or property value using SpEL. Interviewers expect you to discuss the benefits of bulk binding, immutability, and how @ConfigurationProperties works with @EnableConfigurationProperties or @ConstructorBinding for immutable beans.

LinkedIn

How can you integrate Spring Boot with a NoSQL database like MongoDB?

Include spring-boot-starter-data-mongodb, which auto‑configures a MongoTemplate and MongoRepository based on the connection URI in application.yml. Define domain classes with @Document and repositories extending MongoRepository. Interviewers look for awareness of reactive vs synchronous drivers, index creation via @Indexed, and handling of ObjectId mapping to Java types.

eBay

Describe how to implement global exception handling in a Spring Boot REST API.

Create a @ControllerAdvice class with @ExceptionHandler methods that return ResponseEntity objects. Use @ResponseStatus to map custom exceptions to HTTP codes, and optionally log the error. Interviewers expect you to mention handling MethodArgumentNotValidException for validation errors, using Problem Details (RFC 7807) format, and ensuring consistent error payloads across services.

Square

Advanced

What are the advantages and trade‑offs of using Spring Boot’s reactive stack (WebFlux) versus MVC?

WebFlux leverages Project Reactor to provide non‑blocking I/O, enabling higher concurrency with fewer threads, which is ideal for streaming or high‑latency external calls. However, it introduces complexity: you must manage backpressure, understand Mono/Flux semantics, and many third‑party libraries lack reactive support. Interviewers look for a balanced view, citing use cases like chat or event‑driven microservices versus the simplicity of MVC for CRUD APIs.

Netflix

How does Spring Boot support profile‑specific beans and what is a common use case?

Beans can be annotated with @Profile("dev") or @Profile("prod") to load only when the corresponding profile is active. This is useful for swapping implementations, such as an in‑memory repository for tests and a JPA repository for production. Interviewers expect you to discuss activation via spring.profiles.active, fallback mechanisms, and how profile‑specific configuration files (application-dev.yml) complement bean selection.

Dropbox

Explain the role of Spring Boot’s ConditionEvaluationReport and how you would use it during debugging.

ConditionEvaluationReport logs why particular auto‑configuration classes were applied or skipped, showing matched conditions and missing beans. You can enable it by setting debug=true in application.properties or by adding a bean of type ConditionEvaluationReportLoggingListener. Interviewers look for you to demonstrate reading the report to diagnose missing dependencies, conflicting versions, or unexpected bean exclusions.

Cisco

How can you secure a Spring Boot REST API using JWT and what are the key components?

Add spring-boot-starter-security and configure a JwtAuthenticationFilter that extracts the token from the Authorization header, validates it, and sets the Authentication in the SecurityContext. Define a SecurityConfig extending WebSecurityConfigurerAdapter (or SecurityFilterChain bean) to permit public endpoints and protect others. Interviewers expect you to discuss token signing, expiration handling, stateless session management, and the trade‑off of revocation versus simplicity.

Uber

What is the purpose of the @SpringBootTest annotation and how does it differ from @WebMvcTest?

@SpringBootTest loads the full application context, allowing integration testing of beans, repositories, and external services. @WebMvcTest slices the context to only MVC components, mocking service layers. Interviewers want you to explain when to use each: @SpringBootTest for end‑to‑end scenarios, @WebMvcTest for controller logic isolation, and the impact on test speed and resource usage.

GitHub

How does Spring Boot handle graceful shutdown and what configuration is required?

When spring.lifecycle.timeout-per-shutdown-phase is set (default 30s), Spring Boot waits for active requests to complete before closing the ApplicationContext. Enable it via server.shutdown=graceful in application.yml. Interviewers expect you to mention the interaction with embedded Tomcat’s connector, the need for proper @PreDestroy hooks, and how to test shutdown behavior with a SIGTERM simulation.

Slack

Describe how to use Spring Cloud Config with Spring Boot for centralized configuration management.

Add spring-cloud-starter-config and point spring.cloud.config.uri to the Config Server. The client fetches property sources from the server at startup and can refresh them at runtime via /actuator/refresh. Interviewers look for knowledge of profile‑specific property files, encryption of secrets with the server’s symmetric key, and the trade‑off of added network dependency versus centralized control.

Pinterest

What are the implications of using @Transactional on a Spring Boot service method?

@Transactional starts a proxy‑based transaction before method execution and commits or rolls back based on exceptions. It only works on public methods called from outside the bean; self‑invocation bypasses the proxy. Interviewers expect you to discuss propagation options, isolation levels, the impact on lazy loading, and how to handle checked exceptions to avoid unintended commits.

Shopify

Common mistakes

  • Confusing @Value with @ConfigurationProperties, leading to brittle property bindings
  • Disabling auto‑configuration without understanding which beans are lost
  • Using @Component for all beans, missing semantic meaning of @Service/@Repository
  • Neglecting to secure Actuator endpoints, exposing health data publicly
  • Assuming @Transactional works on private or self‑invoked methods

Study plan

  1. Read the official Spring Boot reference guide, focusing on auto‑configuration and starters
  2. Build a sample microservice: add Actuator, security, and a custom embedded server configuration
  3. Practice writing @ConfigurationProperties classes and profile‑specific beans
  4. Implement JWT security and a global @ControllerAdvice, then write integration tests with @SpringBootTest
  5. Explore WebFlux basics, compare performance with MVC, and benchmark simple endpoints

FAQ

Do I need to know the internal code of Spring Boot for an interview?

No, interviewers focus on usage patterns, configuration, and design decisions. Understanding the high‑level architecture, key annotations, and how to troubleshoot auto‑configuration is sufficient.

How much Java knowledge is required alongside Spring Boot?

A solid grasp of Java 8+ features, collections, streams, and concurrency is essential. Spring Boot builds on these fundamentals, so expect Java‑centric questions interleaved with framework topics.

Can I skip learning about Spring Cloud when preparing for Spring Boot questions?

While not mandatory, many companies combine Spring Boot with Spring Cloud for configuration and discovery. Knowing the basics of Config Server and Eureka can give you an edge.

What is the best way to demonstrate performance awareness in a Spring Boot interview?

Discuss profiling tools (Actuator metrics, Micrometer), connection pool tuning, lazy loading, and the impact of reactive versus servlet stacks. Provide concrete examples of reducing startup time or memory footprint.

How important is testing knowledge for Spring Boot roles?

Very important. Interviewers expect familiarity with @SpringBootTest, @WebMvcTest, MockMvc, TestRestTemplate, and how to mock beans. Show that you can write fast unit tests and reliable integration tests.

Related

Ready for your next interview?

Download MiPrep AI. Load your resume and the job description. Show up ready.

Free tier · No credit card · macOS 14+ · Windows 10+

Free tier · No credit card · Runs on your Mac or Windows machine