Spring Boot interview questions: answers checked against the docs
Core Spring Boot and Spring questions, answered in plain words and checked against the official Spring documentation.
Spring Boot interviews cover what Boot adds to Spring (auto-configuration, starters, an embedded server), @SpringBootApplication, dependency injection and bean scopes, profiles and configuration order, Actuator, why @Transactional can silently fail on self-invocation, testing with @SpringBootTest and slices, and DevTools. Below are 15 questions; each answer lists the official page it was checked against.
Basic spring boot interview questions
Basic1. What is Spring Boot, and how is it different from the Spring Framework?
Spring Framework provides the core features: dependency injection, transactions, web MVC and data access. Spring Boot sits on top and removes much of the setup: it configures your application from the libraries on the classpath, offers starter dependencies, and runs with an embedded web server, so you can start an application with a main method.
Checked against: Spring Boot reference: auto-configuration, Spring Boot reference: build systems and starters, Spring Framework reference: the IoC container
Basic2. What does @SpringBootApplication do?
It combines three annotations in one: @EnableAutoConfiguration (turn on auto-configuration), @ComponentScan (find components in the application's package and below) and @SpringBootConfiguration (a configuration class). That is why the main class usually sits in the root package.
Java snippet · illustrative, not run on this page@SpringBootApplication
public class JobsApplication {
public static void main(String[] args) {
SpringApplication.run(JobsApplication.class, args);
}
}Checked against: Spring Boot reference: @SpringBootApplication
Basic3. What is auto-configuration?
Spring Boot looks at the jars you have added and configures beans you are likely to need. For example, a database driver on the classpath with no DataSource defined leads Boot to configure one. It backs off as soon as you define your own bean of that type.
Checked against: Spring Boot reference: auto-configuration
Basic4. What are Spring Boot starters?
Starters are dependency descriptors that pull in a tested set of libraries for one job, such as spring-boot-starter-web for web applications or spring-boot-starter-data-jpa for JPA, so you do not hunt for compatible versions yourself.
Maven XML (pom.xml) snippet · illustrative, not run on this page<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>Checked against: Spring Boot reference: build systems and starters
Basic5. Which web server does a Spring Boot web application run on?
The classic web starter uses an embedded Tomcat by default, so the application is a runnable jar that contains its own server. You can switch to another embedded server by changing dependencies.
Checked against: Spring Boot reference: build systems and starters
Intermediate spring boot interview questions
Intermediate6. What is dependency injection, and why is constructor injection preferred?
Instead of creating its collaborators, a class declares them, and the Spring container supplies them. Constructor injection makes dependencies explicit, lets fields be final and makes the class easy to test with plain objects.
Java snippet · illustrative, not run on this page@Service
public class JobService {
private final JobRepository repo;
public JobService(JobRepository repo) { // injected by Spring
this.repo = repo;
}
}Checked against: Spring Framework reference: the IoC container
Intermediate7. What bean scopes exist, and what is the default?
The default is singleton: one shared instance per container. Prototype creates a new instance each time the bean is requested. Web applications add request and session scopes. Interviewers often follow up on thread safety, because a singleton must not hold per-request state.
Checked against: Spring Framework reference: bean scopes
Intermediate8. How do profiles work?
Profiles let you switch configuration and beans per environment, such as dev and prod. Mark beans with @Profile or use profile-specific files like application-prod.properties, and choose the active profiles with spring.profiles.active.
application.properties snippet · illustrative, not run on this page# application.properties
spring.profiles.active=dev
# application-dev.properties
logging.level.root=DEBUGChecked against: Spring Boot reference: profiles
Intermediate9. How does Spring Boot decide which configuration value wins?
Configuration comes from many sources (properties files, environment variables, command-line arguments and more) in a fixed order, and later sources override earlier ones. That is why a command-line argument beats a value in application.properties.
Checked against: Spring Boot reference: externalized configuration
Intermediate10. What is Spring Boot Actuator?
Actuator adds endpoints to monitor and manage a running application, such as health, metrics and info, under /actuator. By default only the health endpoint is exposed over HTTP, because the others can reveal sensitive details; you expose more deliberately.
Checked against: Spring Boot reference: Actuator endpoints
Advanced spring boot interview questions
Advanced11. Why does @Transactional sometimes do nothing?
Spring applies transactions through a proxy around the bean. A call from one method to another inside the same class does not go through that proxy, so an annotated method called that way runs without a transaction. Move it to another bean or restructure the call.
Checked against: Spring Framework reference: @Transactional
Advanced12. How do you see why an auto-configuration did or did not apply, and how do you turn one off?
Start the application with --debug to print the conditions report, which lists which auto-configurations matched and why. To disable one, use the exclude attribute of @SpringBootApplication.
Java snippet · illustrative, not run on this page@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
public class JobsApplication { }Checked against: Spring Boot reference: auto-configuration
Advanced13. How do you test a Spring Boot application?
@SpringBootTest starts the full application context for integration tests. Test slices such as @WebMvcTest load only part of it, which is faster. @MockitoBean replaces a bean in the context with a Mockito mock.
Java snippet · illustrative, not run on this page@SpringBootTest
class JobServiceTests {
@MockitoBean JobRepository repo;
@Autowired JobService service;
}Checked against: Spring Boot reference: testing
Advanced14. What do DevTools do, and are they safe in production?
spring-boot-devtools restarts the application automatically when classpath files change, which speeds up development. They switch themselves off when you run a fully packaged application, for example with java -jar.
Checked against: Spring Boot reference: developer tools
Advanced15. Which Java version does current Spring Boot need?
The current Spring Boot reference documentation lists Java 17 as the minimum. Ask which Boot and Java versions the team runs, because many production codebases are on older releases or partway through an upgrade.
Checked against: Spring Boot system requirements
How to practice with this page
- Explain each annotation by what it turns on, not just its name.
- Expect follow-ups on proxies and transactions: draw the call path.
- Build a small REST service with a starter, a profile and Actuator to talk from experience.
- Review Java fundamentals too: collections, streams and concurrency come up alongside Spring.
Related interview prep and tools
The core Java questions that come with Spring.
Open →QuestionsREST API interview questionsHTTP methods and status codes, with real responses.
Open →QuestionsSystem design interview questionsService design for senior back-end roles.
Open →RoleJava developerWhat the role involves and how to get hired.
Open →Free toolResume summary generatorDraft a summary for a Java Developer role; the title is filled in, you add your experience.
Open →Free toolLinkedIn headline generatorWrite a headline for a Java Developer search.
Open →Disclosure: TryHired makes HIRED, a paid job-search program, so we have a conflict of interest when we mention it. This question bank is free, with no TryHired signup.
Questions people ask
Are these Spring Boot answers tested?
What Spring Boot topics come up often in interviews?
Do I need to know Spring Framework as well as Spring Boot?
How this page is built
TryHired wrote these questions and answers. Statements about the technology were checked against the official documentation pages listed below, saved when the page was built (2026-11-15). The code snippets are short illustrations and were not run on this page. The question list is general practice: it does not predict what a particular employer will ask.
- Interviewers ask different questions for different roles and levels.
- Answers are short explanations, not complete references.
- No Java code was run on this page; check snippets against your Spring Boot version, because APIs change between major versions.
- Spring Boot reference: Actuator endpoints (read 2026-11-15)
- Spring Boot reference: @SpringBootApplication (read 2026-11-15)
- Spring Boot reference: auto-configuration (read 2026-11-15)
- Spring Boot reference: developer tools (read 2026-11-15)
- Spring Boot reference: externalized configuration (read 2026-11-15)
- Spring Boot reference: profiles (read 2026-11-15)
- Spring Boot reference: build systems and starters (read 2026-11-15)
- Spring Boot system requirements (read 2026-11-15)
- Spring Boot reference: testing (read 2026-11-15)
- Spring Framework reference: the IoC container (read 2026-11-15)
- Spring Framework reference: bean scopes (read 2026-11-15)
- Spring Framework reference: @Transactional (read 2026-11-15)