Spring Boot Interview Questions

Spring Boot aims to simplify Java development with Spring by removing major pain points with respect to configuration, dependency management and ease of development. Below are the most commonly asked spring boot interview questions

1) What is Spring Boot?

Spring Boot is essentially a framework for rapid application development built on top of the Spring Framework. With its auto-configuration and embedded application server support, combined with the extensive documentation and community support it enjoys, Spring Boot is one of the most popular technologies in the Java ecosystem as of date.

2) What Are the Spring Boot Main Features?

Here are a few salient features:

  • Starters – a set of dependency descriptors to include relevant dependencies at a go
  • Auto-configuration – a way to automatically configure an application based on the dependencies present on the classpath
  • Actuator – to get production-ready features such as monitoring Security Logging
  • Spring Initializer – A web application which can create initial project structure for you. This simplifies initial project setup part
  • Spring CLI – It allows you to use Groovy for writing Spring boot application which means a lot more concise code.

3) What is Spring Initializer, Please explain?

Spring Initializr is a convenient way to create a Spring Boot project.

We can go to the Spring Initializr site, choose a dependency management tool (either Maven or Gradle), a language (Java, Kotlin or Groovy), a packaging scheme (Jar or War), version and dependencies, and download the project.

This creates a skeleton project for us and saves setup time so that we can concentrate on adding business logic.

Even when we use our IDE’s (such as STS or Eclipse with STS plugin) new project wizard to create a Spring Boot project, it uses Spring Initializr under the hood.

4) What Spring Boot Starters Are Available out There?

Every starter plays a role as a one-stop-shop for all the Spring technologies we need. All required dependencies are transitively pulled in and managed in a consistent way.

All starters are under the org.springframework.boot group and their names start with spring-boot-starter-. This naming pattern makes it easy to find starters, especially when working with IDEs that support searching dependencies by name.

The most commonly used are:

  • spring-boot-starter: core starter, including auto-configuration support, logging, and YAML
  • spring-boot-starter-aop: starter for aspect-oriented programming with Spring AOP and AspectJ
  • spring-boot-starter-data-jpa: starter for using Spring Data JPA with Hibernate
  • spring-boot-starter-security: starter for using Spring Security
  • spring-boot-starter-test: starter for testing Spring Boot applications
  • spring-boot-starter-web: starter for building web, including RESTful, applications using Spring MVC

There are many more starters avaialable,For a complete list of starters, please check spring boot repository.

5) What is Spring Boot Starter?

This is most commonly asked Spring Boot Interview Questions, You can answer it as below :

Spring Boot provides a number of “Starters” that make easy to manage dependencies for your project.
When you are adding more than one starters spring automatically detects the compatible version for integrating it.
For example if you add spring boot web and spring boot JPA starters, spring automatically detects the right version of spring, JPA and hibernate.
Read More Spring boot starter

6) What is spring-boot-starter-parent?

The spring-boot-starter-parent is a special starter that makes Maven or Gradle dependency-management easier by adding jars to your classpath.
It adds a basic set of spring jars needed for any type of spring based applications.

7) What is spring-boot-starter-web?

This starter will add Tomcat and Spring MVC dependency to our application and its default configuration.

8) What do you understand by Spring Boot Auto Configuration?

Autoconfiguration is way in Spring Boot to configure a spring application automatically on the basis of dependencies that are present on the classpath. It makes development easier and faster.

You can create a custom configuration for a MySQL data source in spring boot as

public class MySQLAutoconfiguration {



9) What is @SpringBootApplication and @EnableAutoConfiguration annotation?

The @EnableAutoConfiguration is used to enable auto-configuration in Spring.

The @SpringBootApplication is in fact combination of @Configuration, @ComponentScan and @EnableAutoConfiguration annotations.

10) what is Spring Boot Actuator, Please explain in detail?

This is most frequently asked Spring Boot Interview Questions.

Actuator brings Spring Boot applications to life by enabling production-ready features. These features allow us to monitor and manage applications when they’re running in production.

To Enable this we need to add the spring-boot-starter-actuator starter in the pom.xml file:

org.springframework.boot spring-boot-starter-actuator
Spring Boot Actuator can expose operational information using either HTTP or JMX endpoints. Most applications go for HTTP, though, where the identity of an endpoint and the /actuator prefix form a URL path.

Below is the most common built-in endpoints Actuator provides:

  • env: Exposes environment properties
  • health: Shows application health information
  • httptrace: Displays HTTP trace information
  • info: Displays arbitrary application information
  • metrics: Shows metrics information
  • loggers: Shows and modifies the configuration of loggers in the application
  • mappings: Displays a list of all @RequestMapping paths

11) What is hot deployment or Spring Dev Tools mean?

You can enable auto-reload/LiveReload of spring boot application by adding the spring-boot-devtools dependency in the pom.xml file.

org.springframework.boot spring-boot-devtools true

This module will can’t be utilized in a production environment.

12) What do you understand by Spring Profiles?

When developing applications for the enterprise, we deal with multiple environments such as Dev, QA, and Prod. The configuration properties for these environments are different.

For example, we might be using an embedded H2 database for Dev, but Prod can have the Oracle or DB2. Even if the database is the same across environments, but the URLs definitely be different.

To make this easy and clean, Spring has the provision of profiles, to help separate the configuration for each environment. So that instead of maintaining this pro-grammatically, the properties can be kept in separate files such as application-dev.properties and application-prod.properties. The default application.properties points to the currently active profile using spring.profiles.active so that the correct configuration is picked up

13) How to Implement Spring Security In Spring Boot Application?

Usage of spring security in Spring boot application requires quite a little configuration. You have to include spring-boot-starter-security starter in pom.xml. You need to make spring config class, which will expand WebSecurity Configure Adapter and override expected strategy to accomplish security in Spring boot application.

14) What Is the Configuration File Name, which is used By Spring Boot?

The configuration file name, which is utilized as a part of spring boot projects is application.properties. This document is very important where we would overwrite all the default setups. Ordinarily, we need to hold this document under the assets folder of the project.

15) What embedded containers does Spring Boot support?

Spring Boot support three embedded containers: Tomcat, Jetty, and Undertow. By default, it uses Tomcat as embedded containers but you can change it to Jetty or Undertow.

16) Can you change the port of Embedded Tomcat server in Spring boot? If Yes, How?

Yes, we can change the port of Embedded Tomcat Server in Spring Boot by adding a property called server.port in the application.properties file.

17) Can you control logging with Spring Boot? If Yes How to do This?

Yes, we can control logging with Spring Boot by specifying log levels on application.properties file. Spring Boot loads this file when it exists in the classpath and it can be used to configure both Spring Boot and application code.

Spring Boot uses Commons Logging for all internal logging and you can change log levels by adding following lines in the application.properties file:


18) How to enable HTTPS/SSL support in Spring boot?

The SSL support in spring boot project can be added via application.properties and by adding the below entries.


This is most commonly asked spring boot interview questions during a java interview in 2020, Please do check our spring interview question also here.

Leave a Reply 0

Your email address will not be published. Required fields are marked *