'Coding has over 700 languages', '67% of programming jobs aren’t in the technology industry', 'Coding is behind almost everything that is powered by electricity'
Last Updated: Dec 17, 2023

Top Spring Boot Interview Questions and Answers (2023)

Interview guide for product based companies
Free guided path
12 chapters
99+ problems
Earn badges and level up


The Spring Framework is an application and inversion of a control container for the Java platform. Any Java application can use its core features, but these are extensions for creating web applications on top of the Java EE (Enterprise Edition) platform. It does not impose any specific programming model and has become popular in the Java community as an addition to the JavaBeans (EJB) model. The Spring Framework is open source.  

Top Spring Boot Interview Questions and Answers

Click on the following link to read further: Java OOPs Interview Questions and Operating System Interview Questions

Spring Boot is an open-source Java framework for developing Micro Services. Pivotal Team created Spring Boot, which provides a faster and easier way to set up, configure, and run both simple and web-based applications. It combines Spring Framework and Embedded Servers. Spring Boot's major purpose is to reduce development, unit test, and integration test time, and there is no demand for XML configuration with Spring Boot.

Let's get started with Spring Boot Interview Questions!

Spring Boot Interview Questions For Freshers

Let us now read a set of spring boot interview questions and answers for freshers, which will surely help you crack your dream job:

1. What is a Spring boot? 

Sprint boot is the Java-based spring framework used for Rapid Apps Development (to build standalone microservices). It has extra support for auto-configuration and embedded application servers like jetty, tomcat, etc. 

2. Explain the advantages of using Spring Boot?

The advantages are as follows:

  • We don't need to write XML configuration; only a few annotations are required to complete the configuration
  • Easy to understand and develop spring applications
  • Increases productivity and reduces development time
  • Minimum configuration
  • Spring Boot is an existing framework with the addition of the embedded HTTP server and annotation configuration, making it easier to understand and faster the development process

3. Write some features of Spring Boot?

A few features of Spring Boot are given below:

  1. Spring CLI allows you to use Groovy to write Spring boot applications and avoid boilerplate code
  2. Starter Dependency – It aggregates common dependencies together and eventually improves the productivity
  3. Auto-Configuration – This Spring Boot feature helps you load the default configurations according to the project you are working on. In this way, we can avoid any unnecessary WAR files
  4. Spring Initializer is a web application that can create an internal project structure. So, you need not have to manually set up the project structure, and you can use this feature
  5. Spring Actuator – This feature helps while running Spring Boot applications
  6. Logging and Security – The security and logging feature of Spring ensures that all the applications made using Spring Boot are adequately secured without any hassle

4. What is meant by the RAD model?

The RAD(Rapid Application Development) model is a software development process that prioritizes rapid prototyping and speedy development over extensive planning and design phases. It emphasizes iterative development and close collaboration with end-users to quickly produce a functional software product.

5. What are the distinct phases involved in the RAD (Rapid Application Development) model?

There are various phases that are involved in the RAD model:

  1. Business Modeling: Identifying the needs and objectives of the project
  2. Data Modeling: Creating data models to represent the system's data
  3. Process Modeling: Defining system processes and workflows
  4. Application Generation: Rapidly building the software using tools and techniques
  5. Testing and Turnover: Rigorous testing and user feedback to refine the application
  6. Cutover: Deploying the application into the production environment

6. How can I start a Spring Boot executable JAR file?

You can start a Spring Boot executable JAR by running the java -jar command followed by the JAR file's name. 

For example: java -jar myapp.jar.

7. What are the Spring Boot starters, and what are available starters?

Spring starters are a set of convenient dependency management providers that can enable dependencies in the application. These starters make development fast and rapid. All the available starters come under the organization's spring framework.boot group. A few of the famous starters are as follows:

  • Spring-boot-starter: – This is one of the core starters that includes logging, auto-configuration support, and YAML
  • Spring-boot-starter-JDBC – This is used for the HikariCP connection pool with JDBC
  • Spring-boot-starter-web – This is the starter used for building web applications, including RESTful apps using Spring MVC
  • Spring-boot-starter-data-JPA – This is the starter to use Spring Data JPA and Hibernate
  • Spring-boot-starter-security – It is used for Spring Security
  • spring-boot-starter-aop: This is used for aspect-oriented programming with AspectJ and Spring AOP
  • Spring-boot-starter-test: This is the starter for testing Spring Boot applications

8. What is Thymeleaf in Spring Boot?

The Java-based server-side template engine offers elegant and natural temps for a web application.

9. What Spring Boot supports embedded containers? 

Spring Boot supports three embedded containers:

  • Tomcat (used by default)
  • Undertow
  • Jetty

10. How to deploy spring boot applications in tomcat?

Whenever you create your spring boot application and run it, Spring boot will automatically detect the embedded tomcat server and deploy your application on tomcat.

After the successful execution of your application, you will be able to launch your rest endpoints and get a response.

11. What is Spring Actuator, and write its advantages?

Spring Actuator is one of the cool feature of Spring Boot, with the help of which you can easily see what is running inside a running application. So, when you want to debug your application and analyze the logs, you need to understand what is happening in the application. In such a scenario, the Spring Actuator provides easy access to the features such as identifying beans, CPU usage, etc. The Spring Actuator provides an effortless way to access the production-ready REST points and helps to fetch all information from the web. These points are secured using Security's content negotiation strategy.

12. What is Spring Boot dependency management?

Spring Boot dependency management is used for managing dependencies and configuration automatically without need for specifying the version for any of those dependencies.

13. Can you disable particular auto-configuration in spring boot? Explain how?

Yes, we can do that by

  • Using the exclude attribute of @EnableAutoConfiguration
public class CustomConfiguration {}


  • using the exclude attribute for @SpringBootApplication annotation
@SpringBootApplication(exclude= DataSourceAutoConfiguration.class)
public class CustomApplication {}

14. Can Spring Boot be used to creating non-web applications?

Yes, Spring Boot supports both web and non-web applications. We must remove these web dependencies from the classpath and the application context to create the non-web application. 

15. Explain how to use thymeleaf?

Thymeleaf is a server-side Java engine used for web applications. It aims to bring a template for your web application and can integrate well with the Spring Framework and HTML5 Java web applications. To use Thymeleaf, you must add the following code in the pom.xml file. 


16. What does the @SpringBootApplication annotation do?

The @SpringBootApplication annotation is the same as using @Configuration, @EnableAutoConfiguration, and @ComponentScan with default attributes. Spring Boot enables the developer to use any single annotation instead of multiple. But, as we know, Spring provided very loosely coupled features so that we can use them for each annotation per our project needs.  

17. What is the purpose of using @ComponentScan in the class files?

It scanned all the beans and package declarations when we initiated the application. We need to add the @ComponentScan for your class file to scan the components added to your project.

18. How does a spring boot application get started?

Like any other Java program, a Spring Boot application has a main method. This method is an entry point that invokes the SpringApplication#run method to bootstrap the application.

public class Application { 
       public static void main(String[] args) {    
               // other statements     
Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Spring Boot Interview Questions for Experienced

Let us now read a set of spring boot interview questions and answers for experienced, which will surely help you get into your dream company:

19. What is  Docker in Spring Boot?

Docker is a platform for containerization. In Spring Boot, Docker allows you to package your application and its dependencies into a container, ensuring consistency and portability across different environments.

20. What is the ELK stack?

ELK stands for Elasticsearch, Logstash, and Kibana. It is a powerful combination of open-source tools used for log and data analysis. Elasticsearch is used for storage and indexing, Logstash for data collection and processing, and Kibana for data visualization.

21. What is Spring Boot CLI, and what are its benefits?

Spring Boot CLI is a command-line interface that helps you create a spring-based Java application using Groovy.

Example: You don't need to create a getter and setter method, access modifier, or return statement. If you use the JDBC template, it automatically loads for you.

22. What is Swagger in Spring Boot?

It is used for clearly detailing and documenting RESTful APIs in a machine-readable and human-readable format, which is easily understandable for testers, developers, and individuals with little knowledge of source code.

This enables hassle-free application discovery, development, and integration and allows API consumers to interact with remote services with minimum implementation logic.

23. How to create a non-web application in Spring Boot?

Creating a non-web application or a Spring Boot standalone application is very easy and also involves some of a few steps. You must first ensure that your application is properly implemented in the CommandLineRunner interface and its Run method, which is essential for running your application. The run method is one of the main tools of the non-web application.  

24. Which annotations are used to create an Interceptor?

A prominent functionality of Spring Boot, as an Interceptor uses the annotated class @Component and implements the interface HandlerInterceptor.

It contains 3 main methods, which are:

The preHandle() Method − preHandle() is basically used for intercepting the request before the implementation of the handler. If preHandle() returns a "true" boolean value, developers can continue with handler execution. If preHandle() returns a "false" boolean value, developers should stop the handler execution. 

preHandle() implementation looks like this:

    public boolean preHand(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o) throws Exception {
        logger.info(" Pre hand ");
            return 1;
            return 0;

The postHandle() Method − postHandle() is basically used for intercepting a request for following the implementation of the handler. It allows manipulation of the ModelAndView Object before users render it.
postHandle() looks like:
    public void postHand(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, ModelAndView modelAndView) throws Exception {
        logger.info(" Post hand ");
            String status = (String) modelAndView.getModelMap().get("status");
                status = status + "Authentication ";


The afterCompletion() Method − It is HandlerInterceptor callback approach, the afterCompletion() method is used when complete request gets completed.

after completion() looks like:

    public void afterCompltion(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Object o, Exception e) throws Exception {
        logger.info(" After Compltion ");

25. What do we mean by IOC container?

Yet another very common Spring Boot interview question for 5 years of experience is the meaning of IOC container. Well, IOC container is the framework which is responsible for implementing automatic dependency injection. It serves a few purposes, such as injecting dependencies into the class and managing object creation and lifeline. Whenever you need to create an object of any class, an IOC container is useful. Furthermore, it is responsible for injecting all the dependency objects at run time and disposing of the same at the appropriate times. Thus, you no longer need to create or manage any objects manually. 

26. How to create a login page in Spring Boot?

In order to create a simple login page in Spring Boot, you need to take the help of Spring security. It is responsible for securing HTTP endpoints which is also essential for all the users since they have to do the login into the default HTTPS form that is provided by the Spring. Furthermore, there are also a few other steps you need to take to keep in mind, such as adding spring-boot-starter-security dependency in build.gradle. You will also be provided with the default username and password which you can then use for logging in.  

27. What Are some of the basic Annotations that Spring Boot Offers?

Spring Boot's annotations reside in its org.springframework.boot.autoconfigure and its sub-packages. Here are a couple of basic ones: 

@EnableAutoConfiguration – It makes Spring Boot look for auto-configuration beans on its classpath and automatically apply them.

@SpringBootApplication – It is used to denote the main class of a Boot Application. This annotation combines @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes

28. How to create a non-web application in Spring Boot?

Creating non-web application or a Spring Boot standalone application is very easy, and also involves some of a few steps. You need to first ensure that your application is properly implemented in the CommandLineRunner interface and in its Run method, which is essential for the running of your application. The run method is one of the main tools of the non-web application.   

29. What are the @RequestMapping and @RestController annotations in Spring Boot used for?


This annotation helps to provide the routing information and tells to the Spring that any HTTP request must be mapped to this respective Method.

This annotation is used to add the @Response_Body and @Controller annotations to the class


To use this annotation, you first have to import org.springframework.web.


To use this annotation, you first have to import org.springframework.web.


30. What is dependency Injection?

The process of injecting dependent bean objects into target bean objects is called dependency injection.

  • Setter Injection: The IOC container will inject the dependent bean object into the target bean object by calling the setter method
  • Constructor Injection: The IOC container will inject the dependent bean object into the target bean object by calling the target bean constructor
  • Field Injection: The IOC container will inject the dependent bean object into the target bean object by Reflection API

31. What do you understand about auto-configuration in Spring Boot and how to disable one of the auto-configuration?

Auto-configuration is used to automatically configure the required configuration for the application. For example, if you have the data source bean present in the classpath of an application, then it automatically configures the JDBC template. With the help of this auto-configuration, you can create a Java application in a very easy way, as it can automatically configures the required beans, controllers, etc. 

To disable the auto-configuration property, you have to exclude the attribute of @EnableAutoConfiguration, in this scenario where you do want it to be applied.



Spring Boot provides the facility to exclude auto-configuration classes with the help of the Spring.autoconfigure.exclude property. You can go move, and add it either to the application.properties or add multiple classes with comma-separated.

32. What differentiates Hibernate and Spring Data JPA?

A Java Persistence API (JPA) implementation, the hibernate facilitates Object-Relational Mapping (ORM), allowing a person to store, retrieve, map, and help to update application data to and from Java objects. Hibernate maps the data types in Java to SQL data types, and the classes of Java to database tables, relieving developers from the scripting data persistence Structured Query Language programs. 

A Spring Data sub-project, helps Spring Data JPA, on other hand, gives the abstraction over the DAL (Data Access Layer) and applies JPA and Object–Relational Mapping implementations. Spring Data JPA facilitates the implementation of the JPA repositories, and it intends to improve the overall implementation of the DAL to a great extent. 

Must Read Web Developer Interview Questions

Frequently Asked Questions

How do I prepare for a Spring Boot interview?

To prepare for a Spring Boot interview, review Spring Boot basics, understand common use cases, practice coding exercises, familiarize yourself with the Spring Boot ecosystem, and prepare for commonly asked interview questions.

How does @SpringBootApplication work internally?

The @SpringBootApplication annotation in Spring Boot combines @Configuration, @EnableAutoConfiguration, @ComponentScan, and @SpringBootConfiguration into a single, streamlined annotation. It simplifies application setup and enables easy execution with minimal configuration.

What is REST API in Spring Boot?

REST API in Spring Boot is a design pattern for creating scalable and flexible web services that use HTTP to interact with resources. It emphasizes stateless communication, standard HTTP methods, and a uniform interface.

What are three ways to start a Spring Boot?

Three ways to start a Spring Boot application are using the Spring Boot CLI, using an IDE with Spring Boot support, and creating a Maven or Gradle project with Spring Boot starter dependencies.

What is most important in spring boot?

One of the most important features of Spring Boot is its opinionated configuration, which provides pre-set defaults and conventions that make it easier to get started with the framework and reduce the amount of boilerplate code required by developers.

What problems does spring boot solve?

Spring Boot solves the problem of boilerplate code and configuration in building Java web applications. It simplifies and streamlines the development process by providing an opinionated approach to configuration, auto-configuration, and a wide range of starter dependencies.


We hope you have gained insights on Spring Boot Interview Questions through this article. This will help you excel in your interviews and enhance your knowledge of Spring boot. These Spring Boot Interview Questions and Answers suit freshers and experienced candidates. 

Recommended Articles:

You can also consider our Spring Boot Course to give your career an edge over others.

Guided path
Interview guide for product based companies
12 chapters
123+ Problems
Earn badges and level up
Live masterclass