What should I focus on for a Spring Boot interview?
Which database topics should I review first?
Start with JPA, ORM, and query performance. JPA and ORM appeared in 41 of 115 interviews. Performance and caching appeared in 32 of 115 interviews. These were the most common topics in these interviews.
The most asked question covered the causes, detection, and prevention of N+1 queries, asked in 14 of 115 interviews. Some reviewed answers missed the pattern: a query loads a list, then an extra query runs for each item.
Check whether you can:
- Explain that query pattern clearly, then describe how you would detect and prevent it in production.
- Say when you would choose an ORM over raw SQL, and when you would avoid it.
- Explain how you would use pagination for a large dataset.
- Name the trade-offs you would consider before adding caching.
Can I explain Spring Boot and how beans work?
The comparison with Spring Framework and the bean scopes question were among the most asked. Can you explain what Spring Boot offers compared with Spring Framework, rather than only define it?
For beans, check whether you can:
- Explain how singleton and prototype scopes differ.
- Say when beans are created and describe their lifecycle.
- Compare constructor, setter, and field injection.
- Explain the differences between
@Component,@Service,@Repository, and@Controller.
What details should my API and transaction answers include?
State the annotation relationship directly: @RestController combines @Controller and @ResponseBody. Some reviewed answers did not explicitly mention this.
Then check whether you can explain how you would handle request validation and exceptions in a REST API, and where DTOs fit.
For transactions, can you explain where a transaction starts and ends? Describe how @Transactional uses proxies and what happens with self-invocation. Can you explain propagation and say which rollback rules apply?
What should I check beyond databases and beans?
Use these questions to check the other topics:
- Can you explain the difference between authentication and authorization, then describe how you would protect a REST API?
- Can you explain what service discovery and load balancing do in a microservices application?
- Can you describe how you would call an external API?
- Can you explain how you would prevent regressions and troubleshoot a framework issue?
- Can you describe how you would use Actuator endpoints for health checks?
Who gets asked Spring Boot
The 20 most asked Spring Boot questions
Counted by interview, not by mention: a question asked twice in one conversation counts once.
What causes N+1 queries, and how do you detect and prevent them in production?
Asked in 14 of 115 interviews · last asked Oct 15 · Concept · Mid-level
Show answer
N+1 queries happen when one query loads a list, then accessing related data runs another query for each item. Detect them with request traces, query counts, and sampled SQL logs in production. Prevent them with fetch joins, entity graphs, or DTO projections; use batch fetching to reduce extra queries.
- Lazy loading often triggers this, but eager loading can also produce extra queries.
- Batch fetching reduces query count; it does not necessarily produce one query.
- Collection fetch joins can break efficient pagination; page IDs first, then fetch related data.
- Sample production SQL logs and avoid exposing sensitive values.
What the interviewer checks: The interviewer checks whether you can recognize repeated database calls and choose a safe, efficient fetching strategy.
Common mistake (in 3 of 6 reviewed answers): Many answers forget that the pattern is one query for a list followed by an extra query for each item.
Other ways it was asked
- “What is the N+1 query problem, and how do you fix it?”
- “What is the N+1 query problem?”
- “How can you avoid the N+1 query problem?”
How does Spring Boot differ from Spring Framework, and what advantages does it offer?
Asked in 8 of 115 interviews · last asked Oct 16 · Concept · Junior
Show answer
Spring Boot builds on Spring Framework to make applications easier to set up and run. Spring Framework provides core features such as dependency injection and web support. Boot adds auto-configuration, starter dependencies, and embedded servers for web apps. It reduces manual setup and offers health checks and metrics through Actuator.
- Spring Boot uses Spring Framework; it does not replace it.
- Auto-configuration applies defaults based on dependencies and settings; you can override them.
- Starters group common dependencies, while Boot manages compatible dependency versions.
- Embedded servers let web apps run without a separately installed application server.
What the interviewer checks: The interviewer checks whether you understand Spring’s core role and how Boot simplifies setup, deployment, and monitoring.
Other ways it was asked
- “What is the difference between Spring and Spring Boot?”
- “What is the difference between the Spring Framework and Spring Boot?”
- “What is the difference between Spring Framework and Spring Boot?”
What bean scopes does Spring support, and how do singleton and prototype scopes work?
Asked in 8 of 115 interviews · last asked Sep 28 · Concept · Mid-level
Show answer
Spring supports singleton, prototype, request, session, application, and websocket scopes, plus custom scopes. Singleton is the default: one instance per bean definition per Spring container. Prototype creates a new instance whenever the container is asked for that bean. A prototype injected into a singleton is not recreated on each use.
- Request means one instance per HTTP request; session means one instance per HTTP session.
- Application means one instance per ServletContext; websocket means one instance per WebSocket session.
- Request, session, application, and websocket scopes require a web-aware application context.
- Spring initializes prototype beans but does not call their destruction callbacks; cleanup is your responsibility.
What the interviewer checks: The interviewer checks whether you understand bean lifetimes, instance sharing, and the limits of prototype scope.
Other ways it was asked
- “What different scopes can a Spring bean have?”
- “What scopes are available for Spring beans, and what does each scope mean?”
- “What bean scopes does Spring support, and how do they affect bean lifecycles?”
Why use an ORM instead of raw SQL, and when would you avoid it?
Asked in 8 of 115 interviews · last asked Oct 7 · Concept · Mid-level
Show answer
An ORM maps database rows to objects and reduces repeated code for common database operations. It can make an application easier to build and maintain, but generated queries may be inefficient. I would use raw SQL for complex reports, database-specific features, or queries needing precise performance control. Both can be used in the same application.
- An ORM handles object mapping and relationships; some also track changes.
- You still need SQL knowledge and must check generated queries.
- Lazy loading can cause N+1 queries: one initial query followed by many extra queries.
- Raw SQL gives direct query control but requires more manual mapping and maintenance.
What the interviewer checks: The interviewer is checking whether you can balance simpler development with query control and performance.
Other ways it was asked
- “What are the differences between using an ORM and writing raw SQL queries?”
- “Why use an ORM instead of writing only raw SQL?”
- “What is the advantage of an ORM? Forgetting the technical aspect, why do we need an ORM in the first place?”
Can you explain Spring Boot?
Asked in 7 of 115 interviews · last asked Oct 1 · Concept · Junior
Show answer
Spring Boot builds on the Spring Framework to make Java applications easier to set up and run. It provides auto-configuration, starter dependencies, and embedded servers for web applications. This reduces manual setup, so I can focus on application logic.
- Auto-configuration sets up Spring features based on dependencies, settings, and existing beans.
- Starters group common dependencies, such as those needed for a web application.
- Web applications can run as executable JAR files without a separate server installation.
- You can override the defaults with your own configuration.
What the interviewer checks: The interviewer checks whether you understand what Spring Boot adds to Spring and why it reduces setup work.
Other ways it was asked
- “What is Spring Boot?”
- “What is Spring Boot? Can you give me an example?”
- “What is a Spring Boot application?”
When are Spring beans created, and what happens during their lifecycle?
Asked in 5 of 115 interviews · last asked Oct 16 · Concept · Mid-level
Show answer
Spring creates non-lazy singleton beans at context startup, lazy beans when first needed, and prototype beans on each request. It creates the instance, injects dependencies, and runs initialization callbacks, with bean post-processors running before and after initialization. When the context closes, Spring runs destruction callbacks for managed singletons.
- A lazy bean may still be created at startup if an eager bean needs it.
- Initialization order is @PostConstruct, InitializingBean.afterPropertiesSet(), then a custom init method.
- Bean post-processors can wrap beans in proxies, such as those used for transactions.
- Destruction order is @PreDestroy, DisposableBean.destroy(), then a custom destroy method; Spring does not automatically destroy prototype beans.
What the interviewer checks: The interviewer checks whether you understand creation timing, lifecycle callbacks, and how bean scope affects cleanup.
Other ways it was asked
- “What is the lifecycle of a Spring bean?”
- “What is the Spring bean lifecycle?”
- “Can you explain the Spring bean life cycle?”
What are Spring stereotype annotations, and how do @Component, @Service, @Repository, and @Controller differ?
Asked in 5 of 115 interviews · last asked Oct 16 · Concept · Mid-level
Show answer
Spring stereotype annotations mark classes for detection and registration as beans during component scanning. @Component is general-purpose, while @Service marks business logic. @Repository marks data access and supports translation of persistence exceptions into Spring data access exceptions. @Controller marks a Spring MVC web controller.
- @Service, @Repository, and @Controller are specialized forms of @Component.
- @Service adds meaning but does not automatically add transactions or other behavior.
- @Repository exception translation requires Spring’s exception translation support to be enabled.
- @Controller methods can return view names; @ResponseBody makes their return values response bodies instead.
What the interviewer checks: The interviewer checks whether you understand each annotation’s role and which ones enable behavior beyond bean registration.
Other ways it was asked
- “What is the difference between @Component, @Service, and @Repository?”
- “Can you explain the difference between @Component, @Service, @Repository, and @Controller?”
- “In Spring, what is the difference between the @Service and @Component annotations?”
What are the differences between constructor, setter, and field injection in Spring?
Asked in 5 of 115 interviews · last asked Oct 16 · Concept · Junior
Show answer
Spring supports constructor, setter, and field injection. Constructor injection passes dependencies through a constructor and is recommended for required dependencies because it supports final fields and easy testing. Setter injection passes dependencies through setter methods and suits optional or changeable dependencies. Field injection injects directly into fields but hides dependencies and makes testing without Spring harder.
- Constructor injection makes required dependencies explicit and ensures they are supplied when the object is created.
- Setter injection allows later changes; optional dependencies need safe defaults or handling when absent.
- Field injection usually uses @Autowired.
- Since Spring 4.3, a single constructor does not need @Autowired.
What the interviewer checks: The interviewer checks whether you understand the injection styles and why constructor injection is usually preferred.
Other ways it was asked
- “What types of dependency injection does Spring support, which type is recommended, and why?”
- “What are the types of dependency injection in Spring?”
- “What are the types of dependency injection?”
What is the difference between @Controller and @RestController?
Asked in 5 of 115 interviews · last asked Oct 22 · Concept · Mid-level
Show answer
@Controller handles web requests and often returns a view name for an HTML page. @RestController combines @Controller and @ResponseBody, so return values go into the HTTP response body rather than becoming view names. It is commonly used for APIs that return JSON.
- @Controller methods can use @ResponseBody to return data instead of a view.
- @RestController returns data through HTTP message converters; the format is not always JSON.
- A String returned from a @RestController method is response content, not a view name.
What the interviewer checks: The interviewer checks whether you understand view rendering versus response body handling.
Common mistake (in 4 of 5 reviewed answers): Many answers forget that @RestController combines @Controller and @ResponseBody, so state this explicitly.
Other ways it was asked
- “What is the difference between @Controller and @RestController in Spring?”
- “Can you tell me the difference between a controller and a REST controller?”
- “What is the difference between a REST controller and a controller?”
How do you use @Transactional to manage database transactions in Spring Boot?
Asked in 5 of 115 interviews · last asked Oct 12 · Concept · Mid-level
Show answer
@Transactional tells Spring to run a method within a database transaction. By default, it joins an existing transaction or starts a new one. Spring commits a new transaction when the method succeeds. Runtime exceptions and errors trigger rollback by default; checked exceptions need a rule such as rollbackFor.
- Usually place it on public service methods that group related database changes.
- The object must be Spring-managed, with transaction management enabled and a suitable transaction manager configured.
- With default proxy-based handling, calls must go through the proxy; calls within the same object bypass it.
- An existing transaction commits at its outer boundary, not when the annotated method returns.
What the interviewer checks: The interviewer checks whether you understand transaction boundaries, rollback rules, and the conditions needed for the annotation to work.
Other ways it was asked
- “What is the use of the @Transactional annotation?”
- “Why should we use the @Transactional annotation?”
- “How would you manage a transaction in a Spring method?”
How does ORM change tracking work, and when should you use tracking versus no-tracking queries?
Asked in 4 of 115 interviews · last asked Sep 10 · Concept · Mid-level
Show answer
ORM change tracking remembers loaded entities and detects changes, often by comparing values with saved snapshots. Use tracking when you will update entities and save through the same context or session. Use no-tracking queries for read-only results to reduce memory use and tracking work.
- EF Core tracks entity queries by default; AsNoTracking() disables tracking for the query.
- Changes to untracked entities require attaching them or using an explicit update operation.
- Long-lived contexts can hold stale entities and consume extra memory.
- Hibernate read-only entities can remain managed; read-only mode is not the same as EF Core's AsNoTracking().
What the interviewer checks: The interviewer checks whether you understand automatic updates, tracking costs, and the difference between read and write operations.
Other ways it was asked
- “What is change tracking in Entity Framework, and when would you use it?”
- “What is change tracking in Entity Framework, and what problems can it cause?”
- “When should repositories use entity tracking versus no-tracking queries, and why?”
What is inversion of control, and how does Spring implement it through dependency injection?
Asked in 3 of 115 interviews · last asked Oct 7 · Concept · Mid-level
Show answer
Inversion of control means the framework manages object creation and wiring instead of your code doing it. Spring implements this through dependency injection: its container creates objects called beans and supplies the dependencies they need. Dependency injection is a way to achieve inversion of control.
- Spring's ApplicationContext is the container that creates, wires, and manages beans.
- Beans can be registered through component scanning or @Bean methods in configuration classes.
- Constructor injection makes required dependencies clear and makes classes easier to test.
What the interviewer checks: The interviewer checks whether you understand who creates objects and how Spring supplies their dependencies.
Other ways it was asked
- “What does inversion of control mean in a Spring application?”
- “What is inversion of control in Spring Boot?”
- “What is the relationship between inversion of control and dependency injection, and how does Spring illustrate inversion of control?”
How do you handle exceptions globally in a Spring application?
Asked in 3 of 115 interviews · last asked Sep 22 · Tooling · Junior
Show answer
Use @RestControllerAdvice with @ExceptionHandler methods to handle exceptions across REST controllers. Each method maps an exception type to an HTTP status and a consistent error body, often using ResponseEntity. For MVC views, use @ControllerAdvice instead.
- Use specific exception handlers for expected errors, such as missing resources or invalid input.
- Log unexpected errors and return a safe message without internal details.
- Controller advice does not automatically catch exceptions from filters, background jobs, or every application layer.
Codeimport org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.ExceptionHandler; import org.springframework.web.bind.annotation.RestControllerAdvice; @RestControllerAdvice class GlobalExceptionHandler { @ExceptionHandler(IllegalArgumentException.class) ResponseEntity<String> handleInvalidArgument(IllegalArgumentException ex) { return ResponseEntity.badRequest().body("Invalid request"); } }What the interviewer checks: The interviewer checks whether you can centralize web error handling, choose suitable HTTP statuses, and understand its limits.
Other ways it was asked
- “How would you implement global exception handling in Spring to catch exceptions from across an application?”
- “How does Spring Boot handle global exception handling?”
What is an ORM?
Asked in 3 of 115 interviews · last asked Jul 30 · Concept · Junior
Show answer
ORM means Object-Relational Mapping. It maps application objects to tables in a relational database, so you can work with objects instead of writing SQL for every operation. Hibernate is a common ORM framework used with Spring Boot.
- Classes usually map to tables, fields to columns, and objects to rows.
- An ORM can handle saving, loading, updating, and deleting data.
- JPA defines a Java persistence standard; Hibernate implements it.
- You still need SQL knowledge to understand queries and fix performance problems.
What the interviewer checks: The interviewer checks whether you understand how objects map to relational data and can name an ORM framework.
Other ways it was asked
- “What is ORM?”
- “What is an ORM? Can you name one?”
In Spring, does @Transactional work when one method calls another @Transactional method in the same class?
Asked in 3 of 115 interviews · last asked Sep 1 · Concept · Senior
Show answer
Not for the inner call in Spring's default proxy mode. A call within the same object bypasses the proxy, so the inner method's @Transactional settings are ignored. If the outer method already has a transaction, the inner method uses it; otherwise, the inner annotation does not start one.
- The outer method's annotation applies when its call goes through the Spring proxy.
- Inner settings such as REQUIRES_NEW are ignored during a same-object call.
- Move the inner method to another Spring bean and call it through that bean's proxy.
- AspectJ transaction mode can support same-object calls, but requires weaving.
What the interviewer checks: The interviewer checks whether you understand proxy-based transactions and why same-object calls bypass transaction handling.
Other ways it was asked
- “If a method annotated with @Transactional is called from another method in the same class, will a transaction start?”
- “What happens in Spring when one transactional method calls another transactional method?”
How would you diagnose and fix intermittent EF Core query slowdowns without changing the database schema?
Asked in 3 of 115 interviews · last asked Oct 16 · Scenario · Senior
Show answer
I would compare fast and slow requests using EF Core command logs and request traces. I would check SQL, parameter values, database execution plans, blocking, and connection pool waits. Based on the cause, I would reduce query count, select fewer columns, or remove unnecessary tracking. I would verify the fix under realistic load without changing the schema.
- Use EF Core logging or a command interceptor; compare database time with total request time.
- Use database-specific tools to inspect execution plans, blocking, and parameter-sensitive performance.
- Fix N+1 queries, project needed fields, and use AsNoTracking for read-only entity queries.
- Test representative parameters and concurrent requests; avoid logging sensitive parameter values in production.
What the interviewer checks: The interviewer checks whether you can isolate intermittent bottlenecks and choose evidence-based fixes rather than guess.
Other ways it was asked
- “How would you approach diagnosing an intermittent performance regression in an Entity Framework Core query without changing the database schema?”
- “How would you approach diagnosing an intermittent performance regression in an EF Core query without changing the database schema?”
- “Could you elaborate on any specific tools or techniques you use to track performance metrics or diagnose issues in EF Core queries?”
What are eager and lazy loading, and how does lazy loading work in Hibernate?
Asked in 3 of 115 interviews · last asked Oct 1 · Concept · Mid-level
Show answer
Eager loading fetches related data when an entity is loaded. Lazy loading waits until that data is accessed. Hibernate usually uses proxies or collection wrappers to detect access and fetch the data. If unfetched data is accessed after the Hibernate session closes, a LazyInitializationException can occur.
- Eager loading does not always mean one SQL join; Hibernate may run separate queries.
- Lazy loading avoids unnecessary fetching, but accessing many relationships can cause the N+1 query problem.
- JPA defaults to eager for to-one relationships and lazy for to-many relationships.
- Use a fetch join or entity graph when an operation needs related data.
What the interviewer checks: The interviewer checks whether you understand fetch timing, Hibernate sessions, and the performance trade-offs.
Other ways it was asked
- “What is the difference between lazy loading and eager loading in Entity Framework?”
- “What is lazy loading in Hibernate?”
- “What are eager loading and lazy loading?”
Which Spring modules are commonly used, and what are they used for?
Asked in 2 of 115 interviews · last asked Jul 16 · Concept · Mid-level
Show answer
Common Spring modules include Core, Beans, and Context for dependency injection and bean management. AOP handles shared behavior, such as logging, across methods. JDBC and ORM support database access, while the transaction module manages transactions. Web MVC supports servlet-based web apps, WebFlux supports reactive web apps, and Test supports unit and integration testing.
- The core container creates, configures, and connects application objects called beans.
- ORM integrates persistence tools such as Hibernate; transaction support includes @Transactional.
- Spring MVC and WebFlux are alternative web frameworks with different execution models.
- Spring Boot, Spring Data, and Spring Security are separate Spring projects, not Spring Framework modules.
What the interviewer checks: The interviewer checks whether you can name the main modules and explain where each is used.
Other ways it was asked
- “What are some of the main modules in Spring?”
What is the process through which a Spring Boot application starts?
Asked in 2 of 115 interviews · last asked Sep 18 · Concept · Mid-level
Show answer
A Spring Boot application starts when `main()` calls `SpringApplication.run()`. Spring Boot prepares the environment, creates the application context, and processes configuration, including auto-configuration. It creates and wires beans, and starts an embedded server for a typical web application. It then calls `ApplicationRunner` and `CommandLineRunner` beans before publishing `ApplicationReadyEvent`.
- `@SpringBootApplication` enables component scanning and auto-configuration, and marks the class as configuration.
- Auto-configuration uses conditions based on available classes, properties, and existing beans.
- Non-lazy singleton beans are normally created during context refresh; lazy beans can be created later.
- Non-web applications do not need an embedded server.
What the interviewer checks: The interviewer is checking whether you understand the startup order and how Spring Boot builds the application context.
Other ways it was asked
- “What happens internally when a Spring Boot application starts?”
How do you manage Spring Boot configuration using profiles?
Asked in 2 of 115 interviews · last asked Sep 22 · Tooling · Mid-level
Show answer
Spring profiles let me use different settings and beans for different environments. I keep shared settings in application.properties and environment-specific settings in files like application-dev.properties and application-prod.properties. I activate the required profile with spring.profiles.active, using an environment variable or a command-line argument.
- Profile-specific files override matching settings in the shared configuration.
- Use @Profile on components or configuration classes to load beans only for selected profiles.
- Environment variables and command-line arguments can override settings from configuration files.
- Keep secrets outside the application, such as in environment variables or a secret manager.
Codejava -jar app.jar --spring.profiles.active=prodWhat the interviewer checks: The interviewer checks whether you can separate environment settings, activate profiles, and control which beans load.
Other ways it was asked
- “How do you manage configuration and profiles in Spring Boot?”
- “How do Spring profiles work?”
Spring Boot basics and configuration interview questions
Questions cover Spring fundamentals, framework differences, project setup, startup, annotations, configuration, profiles, and migration to Spring Boot. 17 questions.
How do you create a Spring Boot application?
Asked in 2 of 115 interviews · last asked Oct 14 · Tooling · Junior
Other ways it was asked
- “Can you explain the basic steps for creating a Spring Boot application?”
- “How do you create a Spring Boot project?”
What does @SpringBootApplication do, and which three annotations does it combine?
Asked in 2 of 115 interviews · last asked Oct 16 · Concept · Mid-level
Other ways it was asked
- “What three internal annotations make up @SpringBootApplication?”
- “What does the Spring Boot application annotation do?”
How would you migrate a legacy application to Spring Boot?
Asked once · last asked Oct 16 · Scenario · Senior
How do Spring Boot and Java EE differ, and when would you choose each?
Asked once · last asked Jul 16 · Concept · Mid-level
Why might you choose Spring Boot and MySQL for an application?
Asked once · last asked Sep 27 · Concept · Junior
Can you name some commonly used Spring Boot annotations and explain their purposes?
Asked once · last asked Oct 13 · Concept · Junior
How would you read values from a properties file in a Spring Boot application?
Asked once · last asked Oct 22 · Tooling · Mid-level
Where are YAML or properties configuration files stored in a Spring application?
Asked once · last asked Feb 14 · Concept · Junior
Tell me about Spring.
Asked once · last asked Jul 16 · Concept · Junior
Which do you prefer, C# or Java with Spring Boot, and why?
Asked once · last asked Jul 16 · Concept · Mid-level
What is the basic difference between a YAML file and a properties file?
Asked once · last asked Sep 4 · Concept · Junior
What is the main difference between Node.js and Spring Boot?
Asked once · last asked Oct 19 · Concept · Junior
Spring beans and dependency injection interview questions
Explore how Spring registers, creates, and injects beans, including scopes, lifecycle, circular dependencies, and singleton thread safety. 22 questions.
How does @Qualifier resolve dependency injection ambiguity, and how does it differ from @Primary?
Asked in 2 of 115 interviews · last asked Sep 18 · Concept · Mid-level
Other ways it was asked
- “What is the difference between the @Qualifier and @Primary annotations in Spring?”
- “What is the use of the @Qualifier annotation?”
What is a bean in Spring?
Asked in 2 of 115 interviews · last asked Sep 28 · Concept · Junior
Other ways it was asked
- “What are beans in Spring?”
Why might you instantiate services and an API client manually instead of using Spring or a similar framework?
Asked once · last asked Mar 5 · Concept · Mid-level
How does Spring Boot identify and create a data-access component as a bean?
Asked once · last asked Mar 10 · Concept · Mid-level
In Spring, will a repository class work without the @Repository annotation?
Asked once · last asked Jun 15 · Scenario · Mid-level
What can go wrong with constructor injection in Spring when a class has more than one constructor?
Asked once · last asked Jul 16 · Scenario · Mid-level
How do concurrent requests share singleton Spring beans, and how do you safely handle mutable state?
Asked once · last asked Sep 9 · Scenario · Senior
Other ways it was asked
- “In Spring, how can multiple concurrent requests safely use a singleton employee bean when its shared properties, such as name and ID, are modified?”
- “How does Spring's singleton bean scope work when multiple requests are handled concurrently?”
- “When multiple requests arrive simultaneously, does Spring reuse a singleton bean or create a separate instance for each request?”
In a circular dependency between two Spring beans, which type of dependency injection should you use?
Asked once · last asked Sep 11 · Scenario · Mid-level
If you use constructor injection for a circular dependency between Spring beans, which exception is thrown?
Asked once · last asked Sep 11 · Concept · Mid-level
Can a prototype bean be used inside a singleton bean in Spring, and what issues can arise?
Asked once · last asked Sep 11 · Scenario · Mid-level
Other ways it was asked
- “What is the problem called when a prototype bean is injected into a singleton bean and then reused?”
Why is constructor injection preferred over field injection?
Asked once · last asked Sep 18 · Concept · Mid-level
How can you conditionally initialize Spring components based on a variable?
Asked once · last asked Oct 7 · Scenario · Mid-level
Show 5 more
What is the difference between @Bean and @Component?
Asked once · last asked Oct 7 · Concept · Junior
How do you register a bean in the Spring container?
Asked once · last asked Oct 22 · Tooling · Mid-level
In Spring Boot, should an API client be implemented as a service or component?
Asked once · last asked May 19 · Concept · Mid-level
How would you structure an API client in Spring Boot: as an annotated component or as a regular class?
Asked once · last asked May 19 · Concept · Mid-level
Which design patterns are used in Spring?
Asked once · last asked Jul 27 · Concept · Mid-level
Spring MVC and REST API interview questions
API questions cover request handling, application layers, controllers, HTTP methods, DTOs, validation, exceptions, frontend integration, and Thymeleaf. 19 questions.
Why use DTOs instead of entities when receiving API requests or transferring data?
Asked in 2 of 115 interviews · last asked Sep 29 · Concept · Mid-level
Other ways it was asked
- “Why would you map a database entity to a DTO or another model?”
- “Would you use DTOs or entities to receive data from Angular, and why?”
How do controllers, services, repositories, and entities work together in a Spring Boot application?
Asked in 2 of 115 interviews · last asked Oct 21 · Concept · Mid-level
Other ways it was asked
- “What responsibilities do the different layers of a Spring Boot application have?”
- “In a Spring application, how do the controller, service, repository, and JPA entities work together when registering a contract?”
How do you define a REST controller in Spring Boot, and what does @RestController do?
Asked in 2 of 115 interviews · last asked Jun 20 · Concept · Junior
Other ways it was asked
- “In Spring Boot, which annotation would you use to define a REST controller, and what other annotations or components might it need?”
- “What is the purpose of the @RestController annotation?”
In Spring Boot, how would you design a GET endpoint that accepts a user's ID and returns their information, including retrieving the data from the database?
Asked once · last asked Mar 18 · Tooling · Mid-level
How do you handle validation between React and Spring Boot when a user sends a request from the frontend to the backend?
Asked once · last asked Mar 25 · Scenario · Mid-level
How do you create a REST API in Spring Boot?
Asked once · last asked Jun 20 · Tooling · Junior
How do you render HTML and insert a variable into a Thymeleaf template?
Asked once · last asked Aug 7 · Tooling · Junior
What’s the point of structuring a backend with controllers, services for business logic, and a repository layer for Prisma database calls?
Asked once · last asked Sep 2 · Concept · Mid-level
How would you implement a feature end to end, from an Angular UI and API endpoint through Java, Spring, the database, and final validation?
Asked once · last asked Sep 29 · Behavioral · Mid-level
Other ways it was asked
- “Describe a specific feature you worked on end to end, from the Angular UI and endpoint through Java, the database, and final validation.”
Where should business logic live in a Spring Boot application, and why not in controllers?
Asked once · last asked Sep 29 · Concept · Mid-level
Other ways it was asked
- “Where would you place business logic that must run before data is saved in a Spring Boot application?”
- “Why should business rules generally be placed outside a Spring Boot controller?”
How do you handle duplicate-record exceptions centrally in Spring Boot and return appropriate errors to the frontend?
Asked once · last asked Sep 29 · Scenario · Mid-level
Other ways it was asked
- “If Angular submits syntactically valid data but Spring Boot detects that the record already exists, how would you handle the error from the backend through to the frontend?”
- “What HTTP status code would you return for a duplicate record, and how would you handle exceptions centrally in Spring Boot?”
What is the difference between the PUT and POST methods in Spring Boot?
Asked once · last asked Oct 13 · Concept · Junior
Show 5 more
In Java, how do you typically structure exception handling in a Spring Boot REST API?
Asked once · last asked Oct 24 · Tooling · Mid-level
Other ways it was asked
- “In Java, how do you typically structure exception handling in a Spring Boot REST API so errors are consistent, secure, and easy for clients to consume?”
What is Thymeleaf?
Asked once · last asked Aug 7 · Concept · Junior
In a Spring Boot application, what happens when you use a service in place of a repository?
Asked once · last asked Sep 13 · Concept · Junior
Which Spring Boot component first receives an incoming HTTP request?
Asked once · last asked Sep 29 · Concept · Junior
How does Spring MVC work?
Asked once · last asked Oct 16 · Concept · Mid-level
Spring Data JPA and ORM interview questions
Database questions cover connections, entities, relationships, repositories, queries, pagination, migrations, and ORM concepts across frameworks. 52 questions.
How do you configure a Spring Boot database connection, including its URL and credentials?
Asked in 2 of 115 interviews · last asked Sep 30 · Tooling · Junior
Other ways it was asked
- “How do you connect a Spring Boot application to a database?”
- “How do you connect a database to a Spring Boot application?”
- “Where do you configure the database connection URL and password in a Spring Boot application using JPA?”
What are the differences between the code-first and database-first approaches in Entity Framework, and when would you use each?
Asked in 2 of 115 interviews · last asked Oct 9 · Concept · Mid-level
Other ways it was asked
- “What are the differences between code-first and database-first approaches in Entity Framework Core?”
How do CrudRepository, JpaRepository, and PagingAndSortingRepository differ?
Asked in 2 of 115 interviews · last asked Jul 16 · Concept · Mid-level
Other ways it was asked
- “What is the difference between extending JpaRepository and CrudRepository in Spring Data?”
How does model inheritance work in Odoo, and how do _inherit and _inherits differ?
Asked in 2 of 115 interviews · last asked Aug 24 · Concept · Mid-level
Other ways it was asked
- “What is the difference between Odoo's `_inherit` and `_inherits`, and how do they affect adding fields to a model?”
- “How does model inheritance work in Odoo's ORM?”
What is JPA, and what are its types?
Asked in 2 of 115 interviews · last asked Jul 21 · Concept · Junior
Other ways it was asked
- “What is JPA?”
What is Django ORM?
Asked in 2 of 115 interviews · last asked Sep 16 · Concept · Junior
Other ways it was asked
- “What is the Django ORM?”
How do you map a Java class to a database table using JPA annotations?
Asked in 2 of 115 interviews · last asked Sep 30 · Tooling · Junior
Other ways it was asked
- “Which JPA annotation maps a class to a database table?”
- “How do you map a database table to a JPA entity class, and which annotations do you use?”
How can you define custom queries in Spring Data JPA?
Asked once · last asked Mar 10 · Tooling · Mid-level
Other ways it was asked
- “Where can you declare custom queries in Spring Data JPA?”
What are ORM and Active Record, and how are they used to work with databases?
Asked once · last asked Mar 27 · Concept · Mid-level
How do you interact with a database in FastAPI, and which ORM do you use?
Asked once · last asked Feb 23 · Tooling · Mid-level
How does the JPA entity lifecycle work, and what states can an entity have?
Asked once · last asked Mar 2 · Concept · Mid-level
What is the difference between JPA and JDBC, and when would you use each?
Asked once · last asked Mar 6 · Concept · Mid-level
Show 38 more
What is JPA, and why can it be useful in microservices?
Asked once · last asked Mar 6 · Concept · Mid-level
How do you implement pagination and sorting in Spring Boot using Spring Data repositories?
Asked once · last asked Mar 10 · Tooling · Mid-level
Other ways it was asked
- “How can you implement pagination in Spring Boot?”
- “Can Spring Data JPA repositories support pagination and sorting?”
How do you define and use a Spring Data JPA repository method to find a user by ID?
Asked once · last asked Mar 10 · Tooling · Mid-level
How do you configure JPA to generate primary key values automatically?
Asked once · last asked Mar 10 · Tooling · Junior
Can DTOs be used instead of JPA entities?
Asked once · last asked Mar 25 · Concept · Junior
Other ways it was asked
- “What are the different roles of JPA entities and DTOs, and when should each be used?”
What are the disadvantages of using Mongoose?
Asked once · last asked Apr 16 · Concept · Mid-level
How would you use Spring Boot and MyBatis to write a custom SQL query for a list endpoint?
Asked once · last asked Apr 18 · Tooling · Junior
In Laravel Eloquent, what is the difference between hasOne, hasMany, belongsTo, and belongsToMany, and when would you choose each?
Asked once · last asked May 5 · Concept · Mid-level
Other ways it was asked
- “In Laravel, what's the difference between has, has many, belongs to, and belongs to many, and when would you choose each?”
When should you use direct SQL queries instead of Odoo's ORM?
Asked once · last asked Jul 23 · Concept · Senior
When you override create, write, or another method in an Odoo module, how does that work in the ORM?
Asked once · last asked Aug 24 · Concept · Mid-level
What is an ORM, and how does Dapper differ from Entity Framework?
Asked once · last asked Sep 10 · Concept · Mid-level
How do code-first migrations work in Entity Framework?
Asked once · last asked Sep 10 · Concept · Mid-level
What is the recommended lifetime for an Entity Framework DbContext, and why should it not be shared across parallel operations?
Asked once · last asked Sep 10 · Concept · Senior
How would you use LINQ to find users whose names start with an uppercase N, and why might some LINQ expressions not translate to SQL?
Asked once · last asked Sep 10 · Write code · Mid-level
How would you structure an application’s connection to PostgreSQL through an ORM?
Asked once · last asked Sep 22 · Design · Mid-level
How do you use JPA or Hibernate for database access in Java applications?
Asked once · last asked Sep 23 · Tooling · Mid-level
How would you persist validated data in a Spring application, and when would you use Spring Data, JPA, Hibernate, or native queries?
Asked once · last asked Sep 29 · Concept · Mid-level
When creating multiple Django model instances, how does Django handle an overridden `save()` method?
Asked once · last asked Sep 29 · Concept · Mid-level
How do you define primary and foreign keys in a Spring Boot entity?
Asked once · last asked Sep 30 · Tooling · Junior
Can an ORM execute a query that uses a window function, and what would you do if that query significantly improved the results?
Asked once · last asked Oct 2 · Scenario · Senior
How would you implement the insertion of a new entity in an ASP.NET Core application?
Asked once · last asked Oct 15 · Scenario · Mid-level
Why would you use a one-to-many relationship to model a contract's details and installments?
Asked once · last asked Oct 21 · Concept · Mid-level
Other ways it was asked
- “Why did you use a One-to-Many relationship for the contract details and installments?”
What is a code-first approach, and why does it make working with a database easier?
Asked once · last asked Oct 23 · Concept · Junior
What is a JPA repository?
Asked once · last asked Mar 10 · Concept · Junior
Other ways it was asked
- “What is the purpose of a JPA repository?”
How do you add a new table in Entity Framework?
Asked once · last asked Mar 12 · Tooling · Mid-level
Other ways it was asked
- “How do you add a new table using the database-first approach in Entity Framework?”
What is Odoo's ORM, and what is its role?
Asked once · last asked Aug 24 · Concept · Junior
Other ways it was asked
- “What is Odoo's ORM, which methods does it use, and why is it used?”
What is Spring Data JPA, and what does it provide?
Asked once · last asked Mar 10 · Concept · Junior
Which annotations are commonly used in Spring Data JPA or Hibernate, and what do they do?
Asked once · last asked Mar 10 · Concept · Junior
Can you explain what Mongoose is and where it is used?
Asked once · last asked Apr 16 · Concept · Junior
How do you work with databases, ORM tools, migrations, and SQL?
Asked once · last asked Jun 24 · Tooling · Mid-level
What is PagingAndSortingRepository used for?
Asked once · last asked Jul 16 · Concept · Junior
What is Prisma?
Asked once · last asked Jul 30 · Concept · Junior
What mechanism do ORMs provide for managing changes to a database schema?
Asked once · last asked Aug 5 · Concept · Junior
What does Mongoose's model function do after you create a schema?
Asked once · last asked Sep 15 · Concept · Junior
What ORM or data-access tools can you use to connect Java applications to databases?
Asked once · last asked Sep 23 · Concept · Mid-level
What is the purpose of a repository in Spring?
Asked once · last asked Oct 13 · Concept · Junior
When would you use direct database access versus a code-first approach?
Asked once · last asked Oct 23 · Concept · Mid-level
In a code-first approach, is it easier to switch to a different database?
Asked once · last asked Oct 23 · Concept · Mid-level
Spring Boot transaction interview questions
Work through transaction boundaries, @Transactional, proxies, self-invocation, propagation, rollback rules, and transactions across multiple databases. 7 questions.
How does Spring use proxies to open and close transactions, and which proxy mechanisms does it use?
Asked in 2 of 115 interviews · last asked Jul 16 · Concept · Senior
Other ways it was asked
- “What does Spring use under the hood to create proxies for transactions?”
- “How does Spring's proxy-based transaction management work under the hood?”
- “How does Spring's @Transactional annotation open and close transactions?”
What transaction propagation modes does Spring support, and how do REQUIRED and REQUIRES_NEW differ?
Asked in 2 of 115 interviews · last asked Oct 9 · Concept · Mid-level
Other ways it was asked
- “What do the REQUIRED and REQUIRES_NEW propagation modes mean in a Spring transaction?”
- “What transaction propagation levels does Spring support?”
How does Spring Boot handle rollback when an operation involving multiple database tables fails, and what approaches can you use?
Asked once · last asked Sep 30 · Scenario · Mid-level
How do you manage a transaction that spans multiple databases in a Spring Boot application?
Asked once · last asked Sep 30 · Scenario · Senior
In Spring, under what conditions does a transaction roll back for checked and unchecked exceptions?
Asked once · last asked Oct 9 · Concept · Mid-level
Spring Security interview questions
Security questions focus on authentication, authorization, REST API protection, OAuth 2.0, JWT security, and external identity providers. 6 questions.
How do you secure a Spring application and its REST APIs using Spring Security?
Asked in 2 of 115 interviews · last asked Oct 16 · Scenario · Mid-level
Other ways it was asked
- “How do you use Spring Security to secure a Java application?”
- “How do you secure REST APIs using Spring Security?”
What is Spring Security?
Asked in 2 of 115 interviews · last asked Apr 9 · Concept · Junior
Other ways it was asked
- “Could you briefly explain Spring Security?”
What are authentication and authorization, how do they relate to Hibernate, and what is OAuth 2.0?
Asked once · last asked Jul 17 · Concept · Mid-level
Other ways it was asked
- “What are authentication and authorization, and how is OAuth 2.0 used in SAP Hybris?”
- “What is authentication and authorization in SAP Hybris, and how is OAuth2 used?”
How is Spring Security used in SAP Hybris, and how does it relate to Hibernate?
Asked once · last asked Jul 17 · Concept · Mid-level
When you're implementing JWT-based authentication in a Java Spring application, how do you ensure that the tokens remain secure and aren't compromised during transmission or storage?
Asked once · last asked Aug 20 · Scenario · Mid-level
Why might you use Spring Security when Amazon Cognito and API Gateway already handle authentication?
Asked once · last asked Sep 23 · Concept · Senior
Spring Boot performance and caching interview questions
Review questions about N+1 queries, loading strategies, change tracking, query execution, ORM performance, large datasets, and caching trade-offs. 20 questions.
How do you handle Entity Framework's N+1 query problem?
Asked in 2 of 115 interviews · last asked Oct 10 · Scenario · Mid-level
Other ways it was asked
- “What is the N+1 query problem in Entity Framework Core? Give a concrete example of how it occurs and how you would fix it.”
Why can marking every property of an entity as modified in Entity Framework be dangerous?
Asked once · last asked Jul 16 · Concept · Mid-level
Other ways it was asked
- “What are the consequences of marking every property of an entity as modified in Entity Framework?”
What performance challenges can arise when using plain JPA with large database tables?
Asked once · last asked Mar 6 · Concept · Mid-level
How can you implement caching in Spring, and what libraries can you use?
Asked once · last asked Mar 6 · Tooling · Mid-level
In Eloquent, what's the difference between lazy loading, eager loading with with, and lazy eager loading with load, and when would you use each?
Asked once · last asked May 5 · Concept · Mid-level
In Laravel and Eloquent, how do you prevent or detect N+1 queries in production, and what tools or patterns do you rely on?
Asked once · last asked May 5 · Scenario · Senior
For a high-traffic endpoint that returns a list with nested relations, how do you decide between eager loading more data and introducing caching to reduce load? What do you cache: the full response, per-model data, or query results?
Asked once · last asked May 5 · Design · Senior
How would you configure Hibernate caching and tune Hibernate performance?
Asked once · last asked May 25 · Tooling · Senior
What problems can occur if you call AsEnumerable too early in a LINQ to Entity Framework query, especially regarding performance and filtering?
Asked once · last asked Aug 4 · Scenario · Senior
What is the purpose of Hibernate caching?
Asked once · last asked Aug 7 · Concept · Mid-level
What is the N+1 query problem in Odoo, and how can you identify it?
Asked once · last asked Aug 14 · Concept · Mid-level
How do you identify and fix the N+1 query problem in Django ORM, SQLAlchemy, or Odoo?
Asked once · last asked Aug 14 · Scenario · Mid-level
Show 4 more
Doesn't using Sequelize make queries slower because it converts them?
Asked once · last asked Dec 9 · Concept · Mid-level
What is the difference between select_related and prefetch_related?
Asked once · last asked Sep 12 · Concept · Mid-level
What does a Django QuerySet represent, and when is its SQL query executed?
Asked once · last asked Sep 29 · Concept · Mid-level
Other ways it was asked
- “When is the SQL query executed for `Event.objects.all()` in Django?”
- “Is a Django QuerySet the result of a database query or a representation of a query that has not necessarily been executed?”
How can you avoid excessive SQL queries when retrieving multiple Django objects with related fields?
Asked once · last asked Sep 29 · Scenario · Mid-level
Spring Boot microservices and integration interview questions
These questions cover scalable architecture, Spring Cloud, service discovery, load balancing, external APIs, machine learning integration, Kafka, and Spring Batch. 14 questions.
Would you choose Spring WebClient over RestTemplate when integrating with Google Gemini?
Asked in 2 of 115 interviews · last asked Oct 19 · Concept · Mid-level
Other ways it was asked
- “When integrating with Google Gemini, why would you choose Spring WebClient over RestTemplate?”
How do you implement client-side load balancing using Spring Cloud LoadBalancer?
Asked in 2 of 115 interviews · last asked Oct 22 · Concept · Mid-level
Other ways it was asked
- “What is Spring Cloud LoadBalancer, and how does it support internal load balancing?”
- “How would you support load balancing within a Spring Boot application before using server-side or cloud-side load balancing?”
What are the differences between monolithic systems, microservices, and REST APIs in a Java and Spring Boot backend?
Asked once · last asked Feb 6 · Concept · Senior
What is the purpose of an ItemReader in Spring Batch?
Asked once · last asked May 29 · Concept · Junior
Which database metadata tables does Spring Batch create by default?
Asked once · last asked May 29 · Concept · Mid-level
How do you handle exceptions in a Spring Batch process?
Asked once · last asked May 29 · Scenario · Mid-level
How do you define a Kafka consumer in Spring, and which annotation do you use?
Asked once · last asked Jun 15 · Tooling · Mid-level
How do you control Kafka offset commits in Spring?
Asked once · last asked Jun 15 · Tooling · Senior
How do you design and develop a scalable microservice using Spring Boot?
Asked once · last asked Aug 4 · Design · Senior
Is Eureka part of Spring's component scan, and how does service discovery work with Spring Boot?
Asked once · last asked Oct 12 · Concept · Mid-level
How can machine learning models be integrated directly with a Spring application?
Asked once · last asked Oct 12 · Concept · Mid-level
How do you use RestTemplate for communication between Spring microservices?
Asked once · last asked Oct 12 · Tooling · Mid-level
Show 2 more
What is Spring Cloud, and what is it used for in microservices?
Asked once · last asked Oct 12 · Concept · Mid-level
Other ways it was asked
- “What is Spring Cloud, and how is it used for load balancing and health checks in microservices?”
What is the purpose of RestTemplate in Spring Boot?
Asked once · last asked Oct 13 · Concept · Junior
Spring Boot testing, deployment and monitoring interview questions
Testing and operations questions cover testable design, regression prevention, troubleshooting, packaging, deployment, Kubernetes compatibility, Actuator endpoints, and health checks. 10 questions.
When implementing Java or Spring Boot processes with dependencies such as databases and external APIs, how do you design them to make testing easier?
Asked once · last asked May 19 · Design · Senior
How do you use Spring Boot documentation or source code when investigating a framework issue?
Asked once · last asked May 19 · Tooling · Senior
What are Spring Boot Actuator endpoints, and what are they used for?
Asked once · last asked Jul 16 · Concept · Mid-level
How do you implement and expose health checks using Spring Boot Actuator?
Asked once · last asked Sep 1 · Tooling · Mid-level
Other ways it was asked
- “How do you implement a health check in Spring Boot?”
- “What annotations or configuration do you use to expose health endpoints with Spring Boot Actuator?”
How do you run a Spring application without an embedded Tomcat server?
Asked once · last asked Oct 16 · Tooling · Mid-level
How would you detect a subtle bug introduced by an AI coding agent in a Spring Boot change, such as a security, transactionality, validation, or mapping issue, and prevent recurrence?
Asked once · last asked Oct 22 · Behavioral · Senior
Other ways it was asked
- “Tell me about a time the agent produced a subtle bug in a Spring Boot change, for example, security, transactionality, validation, or mapping. How did you detect it and prevent recurrence?”
What is a Spring Boot JAR?
Asked once · last asked Sep 4 · Concept · Junior
How does testing differ between Spring and Spring Boot?
Asked once · last asked Oct 13 · Concept · Junior
How will you deploy your Spring Boot application?
Asked once · last asked Oct 13 · Scenario · Mid-level
Which version of Spring Boot is most suitable for use with Kubernetes today?
Asked once · last asked Oct 18 · Concept · Mid-level
Live coding round next? Coding mode in the MeetAssist desktop app solves the problem on your screen, with your phone as the remote.
Related interview questions
- Software Engineer interview questions
- AI Engineer interview questions
- Data Engineer interview questions
- DevOps Engineer interview questions
- Solutions Architect interview questions
- React interview questions
- Angular interview questions
- Node.js interview questions
- Next.js interview questions
- HTML and CSS interview questions
- Android and Kotlin interview questions
- iOS and Swift interview questions
How this list is made
Every question here was asked by a real interviewer in a real job interview that a candidate ran MeetAssist in. After the call, the interviewer's questions are pulled from the transcript. Practice sessions, tests, exams and anything that was not a job interview are dropped.
Questions are rewritten so they make sense on their own: names of people, employers and clients are removed, and speech-to-text mistakes are fixed. Small talk, logistics and questions about one candidate's own résumé are left out. Rephrasings of the same question are merged, and the count is the number of different interviews it came up in.
The interviews come from candidates who use MeetAssist, so they lean towards software, data and AI roles: the shares describe these interviews, not every Spring Boot interview. Answers to the most asked questions are written and checked by an editor; a "common mistake" is shown only when reviews of real answers in these interviews show it, with the count.
115 interviews, 75 candidates, Dec 2025 to Oct 2026. Updated every month with new interviews.
Or add the Chrome extension