Spring Boot Interview Questions

Spring Boot Interview Questions

Read other articles of this series

This post is the part of our Interview Questions series and. In this post, we will discuss some commonly asked Spring Boot interview questions during a job interview.Refer to Spring Boot tutorials for more detail about Spring Boot.

Q1. What is the Spring Boot?

Spring Boot is an opinionated framework for building and running Spring applications. Spring Boot is not a framework for writing applications, think of Spring Boot as a tool which can do these initial tasks for us automatically.

While working on big enterprise projects involving several frameworks, it is complex to handle all configurations and making sure required dependencies are in place. Spring Boot focuses on developer productivity by providing smart auto configuration modules and handling all configurations and dependencies for us.

Read What is Spring Boot for more detail.

Q2 What are the differences between Spring and Spring Boot?

Spring provides several features to help work on the web applications. Some feature provided by core Spring framework are

  • Dependence Injection
  • Data binding
  • AOP
  • Data access (JDBC or JPA etc)

Spring provides these tool set but let the developer to include these modules based on the need. This has become error prone since Spring framework growing more and more complex. Spring Boot is a tool set takes an opinionated view of the platform and libraries, letting us get started quickly.With this approach, a developer can focus on building the business logic and let Spring Boot handle the setup and default configuration.

For more information, read our tutorials Spring Boot vs Spring MVC

Q3. What are the advantages of Spring Boot?

  1. It simplifies Spring dependencies by taking the opinionated view.
  2. Spring Boot provides a pre-configured set of technologies/framework to reduces error-prone configuration so we as a developer focused on building our business logic and not thinking of project setup.
  3. It reduces development code by avoiding a lot of boilerplate code.
  4. Easier to integrate Spring Boot Application with Spring Ecosystem like Spring JDBC, Spring ORM, Spring Data, Spring Security, etc.
  5. You really don’t need those big XML configurations for your project.
  6. Embed Tomcat, Jetty or Undertow directly.
  7. Provide opinionated Maven POM to simplify your configuration.

Q4. What are the different Spring Boot Components?

  1. Boot Initializer
  2. Spring Boot Starter
  3. Auto Configurator.
  4. Spring Boot CLI.
  5. Actuator.
Spring Boot Modules

Q5. What is Spring Boot Starters?

Spring Boot Starters are the set of convenient dependency descriptors which can be easily included in any level of application. These starters work as a bootstrapping process for the Spring related technologies, we no longer need to worry about the dependencies and they will be automatically managed by Spring Boot Starters.

The starters contain a lot of the dependencies you need to get a project up and running quickly and with a consistent, supported a set of managed transitive dependencies. To summarize, Spring Boot Starters are just JAR files used by Spring Boot for auto-dependency.

For more information, read our article Spring Boot Starters

Q6. What Spring Boot starters are available out there?

The starters contain a lot of the dependencies you need to get a project up and running quickly and with a consistent, supported set of managed transitive dependencies. All official starters follow a similar naming pattern; spring-boot-starter-*, where * is a particular application. They intend this naming structure to help when you need to find a starter. Third party starters should not start with spring-boot, as they reserve it for official Spring Boot artifacts

For a complete list, read Spring Boot Starters List

Q7. What is Auto-Configuration in Spring Boot?

It takes a lot of configurations and boilerplate code create a simple Spring MVC application without Spring Boot. Spring Boot Auto Configuration provides an opinionated approach to bootstrap your application. Auto-Configuration will attempt to automatically try to set up our application with default behavior based on the jars in the class-path.For example, if Spring Boot finds HSQLDB in out class-path, it will automatically configure an in-memory database for us. Think of the auto-configuration as an intelligent system which can provide ready to use the application to us based on the configured jars in our class-path.

For detail information please read our article Spring Boot Auto Configuration

Q8. What is Spring Boot CLI?

The Spring Boot CLI is a command-line tool that you can use if we want to quickly develop a Spring application. In simple terms Spring Boot CLI provides the features of 

  • Auto Configurations
  • Dependency resolutions
  • Application servers
  • End point management 

With minimal configurations. It’s a command line abstraction which allow us to run micro-services using Groovy scripts.Since it allows us to run code using Groovy script, Spring Boot CLI provides several advantages:

  • Java like syntax with little boilerplate code.
  • No need to add main class.
  • Ability to run the code from the command line.
  • No Gradle / Maven builds.

Q9. How to register a custom auto-configuration?

Spring Boot checks for a META-INF/spring.factories file within your published jar for the auto-configuration classes. To register our custom auto-configuration class, we should use a fully qualified name of the class under the EnableAutoConfiguration in the spring.factories property file.

org.springframework.boot.autoconfigure.EnableAutoConfiguration=com.javadevjournal.config.HelloServiceAutoConfiguration

To find more information about Spring Boot custom auto-configuration, read custom starter with Spring Boot

Q10. Can we use Spring Boot for non-Spring application?

No, Spring Boot has limited to Spring based application only. We can not use Spring Boot for non Spring applications.

Q11. What are the different options for creating the Spring Boot application

There are multiple options to create a Spring Boot application. We can use any of the following approaches.

Read Building an Application with Spring Boot for detail.

Q12. What is the Spring Boot Initilizr?

Spring Boot Initilizr is a Spring Boot tool to bootstrap Spring Boot or Spring Applications easily. Spring Initializr is also integrated with all major Java IDEs along with CLI.

Q13. What are the advantages of Spring Boot Initializr?

Spring Boot Initializr provides a simple interface to quickly bootstrap a Spring Boot application. Here are benefits or advantages of using Initilizr.

  • Spring Initializr provides an extensible API to generate quick start projects.
  • Reduce time to create an application setup. We can create application setup using a few clicks.
  • It increases Productivity
  • Initializr offers a configuration structure to define all the aspects related to the project to generate: list of dependencies, supported java and boot versions.

For more detail, read Spring Initializr Reference Guide

Q14. How can I reload my Spring Boot changes without restarting the server?

This is achievable by Spring Boot Dev Tools module.it’s a powerful tool for development. It helps developers to shorten the development cycle and enable easy deployment and testing during development.

To enable this feature, add the following dependency to Maven POM file.

<dependencies>
    <dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-devtools</artifactId>
    </dependency>
</dependencies>

Read Spring Boot Dev Tools for different features of Dev Tools.

Q15. How can we override default properties in Spring Boot?

Spring Boot advocate convention over configuration. Spring Boot externalize application configurations through application.properties file. These properties work as default values for the Spring Boot application.To override these default values, Spring Boot provides the following options.

  • Create an application.properties file in the classpath for overriding specific properties for Spring Boot. For Maven based project, this file will be under /src/main/resource.
  • application.yml file in the classpath for overriding specific properties for Spring Boot. For Maven based project, this file will be under /src/main/resource.
  • Through command line switches

e.g. Server HTTP port default to 8080 in the default application.properties file. To change this port to 9090, add the below entry in the custom application.properties file

server.port=9090

Q16. What are the embedded containers supported by Spring Boot?

Spring Boot includes support for the following embedded containers

  1. Tomcat
  2. Jetty
  3. Undertow.

Use the right “Starter” to configure the embedded container. 

Q17. What is the Spring Boot Actuator?

The spring boot actuator provides production-ready features for Spring Boot application. It will help us check and manage our application in the production environment. We need no code to get these features since they are available once the actuator dependency is in the class-path.Add the spring-boot-starter-actuator starter in the pom.xml file to enable Spring Boot Actuator into a project

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>

The actuator provides features like auditing, health, metrics, environment information, thread dump etc. using HTTP or JMX endpoints. Here are some of the most common built-in actuator endpoints:

  • beans – Displays a complete list of all the Spring beans in your application.
  • auditevents -Exposes audit events information for the current application caches – Exposes available caches.
  • configprops – Displays a collated list of all @ConfigurationProperties.
  • health – Shows application health information.
  • info – Displays arbitrary application info.
  • metrics – Shows ‘metrics’ information for the current application.
  • mappings – Displays a collated list of all @RequestMapping paths.
  • sessions – Allows retrieval and deletion of user sessions from a Spring Session-backed session store.
  • threaddump – Performs a thread dump.

Q18. How can we create a custom endpoint in Spring Boot Actuator?

To create a custom endpoint using Spring Boot 1.x, we should expose the instance of the custom endpoint class as a bean. We need to implement Endpoint<T> interface.

@Component
public class CustomEndpoint implements Endpoint {
 //method implimentation
}

Spring Boot 2.x changed it by introducing @Endpoint annotation. Spring Boot expose endpoints with @Endpoint@WebEndpointor @WebEndpointExtension over HTTP using Jersey, Spring MVC, or Spring WebFlux.Read Custom Endpoint in Spring Boot Actuator for more detail.

Q19. What is a shutdown in the actuator?

Spring Boot actuator provides a shutdown endpoint. This endpoint allows the graceful shutdown of the application. This end point disabled by default and we need to enable this in case we need to use this service. We can enable this end point using project.properties 

management.endpoint.shutdown.enabled=true

For more information, read Shutdown a Spring Boot Application

Q20. How to run Spring Boot application to custom port?

Use the application.properties file to configure a custom port for Spring Boot application. To change the server port, use server.port property.

server.port=9001

Read Spring Boot Web Application Configuration for more detail.

Q21. What logging support provided by Spring Boot? How can we control logging level in Spring Boot?

Spring Boot provides options to use all popular logging API using the relevant starter, by default Spring Boot use Commons Logging for its internal logging. If we are using Spring Boot Starters for our application, Logback will be used for logging by default unless we want to use any other logging API. To use any other logging API, we need to add the correct starter in our application. In case we like to use Log4j2 for logging configuration, all you have to add the log4j2 starter in your application (You may have to exclude logback using  pom.xml file).

Spring Boot provides an easy way to configure and set logging levels for your application. We can use application.properties file to configure the desired Logging level for our application by using ‘logging.level.*=LEVEL’. Here is an example for the same.

logging.level.com.javadevjournal.rest=WARN

Read Spring Boot Logging for more detail.

Q22. How to implement security for Spring boot application?

Use the spring-boot-starter-security starter to enable the Spring security support in your Spring Boot application.

<dependency>
   <groupId>org.springframework.boot</groupId>
   <artifactId>spring-boot-starter-security</artifactId>
</dependency>

Q23. How to configure database using Spring Boot?

The Spring Framework provides extensive support for working with SQL databases, from direct JDBC access using JdbcTemplate to complete “object-relational mapping” technologies such as Hibernate. To connect configure the database for your Spring Boot application, use the spring-boot-starter-jdbc or spring-boot-starter-data-jpa “starters”. To configure data-source configuration, use the application.properties file in your application.

spring.datasource.url=jdbc:mysql://localhost/javadevjournal
spring.datasource.username=root
spring.datasource.password=
spring.datasource.driver-class-name=com.mysql.jdbc.Driver

Above example is to configure MySQL in your application. For more information, read Configuring MySQL for Spring Boot Application

Q24. How can we use Jetty instead of the tomcat in our web application?

Spring Boot web starters use Tomcat as the default embedded servlet container. When switching to a different HTTP server, we need to exclude the default dependencies besides including the one we need. Spring Boot provides separate starters for HTTP servers to help make this process as easy as possible. To use Jetty, we need to exclude Tomcat and include Jetty in our application’s pom.xml file.

<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-web</artifactId>
	<exclusions>
		<!-- Exclude the Tomcat dependency -->
		<exclusion>
			<groupId>org.springframework.boot</groupId>
			<artifactId>spring-boot-starter-tomcat</artifactId>
		</exclusion>
	</exclusions>
</dependency>
<!-- Use Jetty instead -->
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

Q25. Why do we need spring-boot-maven-plugin?

Spring Boot Maven plugin provides Spring Boot support in the maven. This plugin provides options to create an executable jar or war files. Here are goals for this plugin.

  • boot: run runs your Spring Boot application.
  • spring-boot:repackage repackages your jar/war to be executable.
  • spring-boot:start and spring-boot:stop to manage the lifecycle of your Spring Boot application (i.e. for integration tests).
  • spring-boot:build-info generates build information that can be used by the Actuator.

To include this plugin in your project, add XML in the plugins section of your pom.xml

<plugins>
	<plugin>
		<groupId>org.springframework.boot</groupId>
		<artifactId>spring-boot-maven-plugin</artifactId>
		<version>2.0.5.RELEASE</version>
		<executions>
			<execution>
				<goals>
					<goal>repackage</goal>
				</goals>
			</execution>
		</executions>
	</plugin>
</plugins>

Q26. How to disable specific auto-configuration in spring boot?

To exclude specific auto-configuration classes, use the exclude attribute of @EnableAutoConfiguration to disable them. Here is a sample code for the same.

@Configuration
@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class CustomConfiguration {
}

Most of the Spring Boot application use the  @SpringBootApplication annotation to enable the auto-configuration feature.we can disable auto-configuration with an attribute of the same name:

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
public class CustomApplication { }

We can also disable an auto-configuration with the spring.autoconfigure.exclude environment property. This setting in the application.properties file does the same thing as before:

spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

Q27. What is the use of YAML in Spring Boot?

YAML is a superset of JSON. Spring Boot YAML as an alternative to the application.properties file to define your project properties. The SpringApplication class automatically supports YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.

Let’s take the following example of the application.properties file.

environments.dev.url=https://dev.javadevjournal.com
environments.dev.name=Developer Setup

It can represent the YAML files as follows.

environments:
   dev:
       url: https://dev.javadevjournal.com
       name: Developer Setup

Q28. What is new in Spring Boot 2.0?

Spring Boot 2.0 brings several features changes to the Spring Boot framework.

  • Spring Boot 2.0 is a baseline to Java 8. Therefore, Spring Boot 2.0 requires Java 8 or later. It doesn’t support Java 6 and Java 7 anymore.
  • It supports Java 9.
  • Spring Boot 2.0 requires Spring Framework 5.0 with Reactive support.
  • Embedded servlet containers support got upgraded
    • Minimum Tomcat version is 8.5
    • Jetty is 9.4
  • Spring Boot 2.0 supports HTTP/2 with the help of server.http2.enabledproperty.
  • The framework requires Gradle 4.x in case you are using Gradle as your build tool.
  • Security configuration simplified in Spring Boot 2.0.
  • A brand new actuator architecture, with support for Spring MVC, WebFlux and Jersey.

For more details, please read.

Q29. What is @SpringBootApplication annotation?

This is one of the most important and core annotation from Spring Boot. We use this annotation to mark the main class of our Spring Boot application.

@SpringBootApplication
public class SpringOrderAnnotationApplication {
 public static void main(String[] args) {
  SpringApplication.run(SpringOrderAnnotationApplication.class, args);
 }
}

@SpringBootApplication is a convenience annotation equal to declaring @Configuration, @EnableAutoConfigurationand @ComponentScan with their default attributes. You have the option to use @Configuration, @EnableAutoConfiguration, and @ComponentScan individually but the recommendation is to @SpringBootApplication annotation.

For more detail, please read Spring Boot Annotations.

Q30. How to include custom static content in Spring Boot application (e.g custom JS code)?

Spring Boot search specific location in the project for serving static contents. By default, Spring Boot serves static content from a directory called /static (or /public or /resources or /META-INF/resources) in the classpath or from the root of the ServletContext.

We can put our custom static content in any of the above folders. For example, put the custom.js file under /resources/static/custom.js. To refer to this file in the view use the following code

<script src = “/js/test.js”></script>

Q31. How to use a profile with Spring Boot?

Spring Boot provides multiple ways to active profile. We can pass profile information through the command line or use application.properties, Spring Boot also provide a way to set profile programmatically. Use profile specific configuration files in our Spring Boot application.we need to the naming convention of application-{profile}.properties where profile defines the name of the intended profile. It will load profile from the same location as application.properties file.

Read Introduction to Spring Profiles Using Spring Boot for more detail.

Q32. How to set the active profile in Spring Boot?

There are two ways to set the active profile in Spring Boot.

  • Pass in the active profile as an argument while launching the application.
  • Use the application.properties file to set the active profile.
java -jar -Dspring.profiles.active=production application-1.0.0-RELEASE.jar //pass as command line argument
spring.profiles.active=production

Q33. How to generate a WAR file with Spring Boot?

We can control the package type generation in our Spring Boot project using spring-boot-maven-plugin To build a war file, we need to follow these 2 steps.

  1. Set the packaging type as a war in our pom.xml file.
  2. Mark the embedded container dependencies as “provided” (To build a war file that is both executable and deploy-able into an external container.)

Here is a snapshot from pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
   <!-- ... -->
   <packaging>war</packaging>
   <!-- ... -->
   <dependencies>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-web</artifactId>
      </dependency>
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
         <scope>provided</scope>
      </dependency>
      <!-- ... -->
   </dependencies>
</project>

Q34. How to disable the web server configuration in your Spring Boot application?

Spring Boot automatically starts an application in web server mode if it finds the web module in the class-path. To disable the web server configuration, set the webApplicationType to none in the application.properties file.

spring.main.web-application-type=none

Q35. How to configure and enable SSL for your Spring Boot application?

Use the server.ssl.* properties in the application.properties or yml file to configure and enable SSL for your Spring Boot application. Here are typical SSL configurations for your application.

server.port=8443 //SSL port
server.ssl.key-store=classpath:keystore.jks //You can also configure it to external location
server.ssl.key-store-password= //password for your key
server.ssl.key-password=//key password

Remember, Spring Boot does not support configuration of both HTTP and HTTPS through the property file. Configure other port programmatically if you need to use both ports.

Q36. Can we create a Non-web application in Spring Boot?

Yes, Spring Boot support creating both web and non-web applications. To create a non-web application, you need to remove web dependencies from your class-path along with changing the way Spring Boot create the application context. Please read Standalone Application Using Spring Boot for more details.

Q37. How the ApplicationContext created by Spring Boot?

Spring Boot creates the ApplicationContext once we execute the SpringApplication.run() command.Spring Boot returns the ConfigurableApplicationContext which extends ApplicationContext. This is how Spring Boot creates and return the context.

public ConfigurableApplicationContext run(String...args) {
 //preparation
 ConfigurableApplicationContext context = null;

 //create and return application context
 context = createApplicationContext();
}

protected ConfigurableApplicationContext createApplicationContext() {
 Class << ? > contextClass = this.applicationContextClass;
 if (contextClass == null) {
  try {
   switch (this.webApplicationType) {
    case SERVLET:
     contextClass = Class.forName(DEFAULT_SERVLET_WEB_CONTEXT_CLASS);
     break;
    case REACTIVE:
     contextClass = Class.forName(DEFAULT_REACTIVE_WEB_CONTEXT_CLASS);
     break;
    default:
     contextClass = Class.forName(DEFAULT_CONTEXT_CLASS);
   }
  } catch (ClassNotFoundException ex) {
   throw new IllegalStateException(
    "Unable create a default ApplicationContext, " +
    "please specify an ApplicationContextClass",
    ex);
  }
 }
 return (ConfigurableApplicationContext) BeanUtils.instantiateClass(contextClass);
}

For more information, refer to the SpringApplication

Q38. How can we externalize SpringApplication configuration?

The SpringApplication class provides setters method to configure and customize its behavior. For example, to switch off the banner (displaying on startup), we can use the .bannelMode(boolean) method.

new SpringApplicationBuilder()
	.bannerMode(Banner.Mode.OFF)
	.run(args);

This can be easily externalized by using the spring.main.*properties in application.properties

spring.main.banner-mode=off

Properties defined in the external configuration override the values specified with the Java API with some exceptions.

Q39. How to enable HTTP Response Compression in Spring Boot?

Spring Boot supports the HTTP response compression for the following application servers:

  1. Tomcat
  2. Jetty
  3. Undertow

To enable this feature, set the server.compression.enabled property to true in the application.properties

server.compression.enabled=true

Use the server.compression.min-response-size property to set the compression length. By default Spring Boot perform compression for the following context type:

    text/html
    text/xml
    text/plain
    text/css
    text/javascript
    application/javascript
    application/json
    application/xml

use the server.compression.mime-types property to customize this list.

Q40. What is Spring Boot Admin?

Spring Boot admin is a community project used to manage and monitor your Spring Boot applications. The client application gets register themselves with the admin server (via HTTP) or is discovered using Spring Cloud discover server like Eureka, Consul.Each client application needs to have Spring Actuator jars in it. The endpoints provided by the Actuator jar is polled by the Spring Boot Admin server to get the metrics of that application.

Actuators endpoints let you monitor and interact with your application. Spring Boot includes several built-in endpoints and lets you add your own. To know more details about these endpoints read Spring Boot Actuator.

Q41. Can we configure Spring Boot to use multiple data sources?

No, Spring Boot does not provide an out of the box solution in case our application needs multiple Data-sources (e.g. multi-tenant system). Spring Boot provides multiple extension point to enable support for multiple data sources. Read multiple data sources with Spring Boot for more detail.

Q42. What is application.properties file in Spring Boot?

 This property file is the central control system for your Spring Boot application. Spring Boot applies its typical convention over configuration approach to property files. Spring Boot provides default application.properties file for the default configurations. When Spring Boot application starters, it refer to this configuration file for the default values.

Spring boot specified various common default properties inside application.properties to support Logging, AOP, Server configurations, caching, JPA, etc. We need not specify all the default properties in all the cases. We can specify them only on-demand.

For the complete list, please refer to the Common application properties

Q43. How to enable HTTP/2 support in Spring Boot?

We can enable HTTP/2 support by using server.http2.enabled configuration property. Please refer to the application server documentation as HTTP/2 is not supported by all web servers.

Q44. What is the use of starter POM in our Spring Boot application?

Spring Boot starter parent is a convenient and easy way for dependency management. With each release, Spring Boot provides a curated list of it supports. While working on the Spring Boot application, you may not need to provide the version number for the dependencies as these are automatically taken care by Spring Boot. Spring Boot manage these curated list of dependencies through the starter pom.

Q45. How to access a value defined in the application.properties file in Spring Boot?

Use the @Value annotation to access the properties defined in the application. properties file.

@Value("${custom.value}")
private String customVal;

For more details, read Externalized Configuration

Q46. What is relaxed binding in Spring Boot?

While binding Environment properties to @ConfigurationProperties beans, Spring Boot uses the relaxed binding feature. This means it does not force the exact match between the Environment property name and the bean property name. We can write such type of Environment property in camelCase,snake_case, or in uppercase with words separated by underscores and Spring Boot will ensure to inject these Environment properties correctly. Let’s take the following example for a better understanding:

@ConfigurationProperties(prefix="javadevjournal.demoapplication-project.person")
public class CustomerProperties {

	private String firstName;

	public String getFirstName() {
		return this.firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}
}

Under relaxed binding, Spring Boot allows the following properties:

  1. javadevjournal.demoapplication-project.person.first-name
  2. javadevjournal.demoApplication.person.firstName
  3. javadevjournal.demo_application.person.first_name
  4. JAVADEVJOURNAL_DEMOAPPLICATION_PERSON_FIRSTNAME

Q47. How to set up Spring Boot application using maven?

Spring Boot provides the option to use maven or Gradle to set up and build the application. We have the following options to build a Spring Boot application using Maven:

  1. Create a simple Maven project and add all required jars (dependencies)
  2. Use Spring Boot dependency feature by using the spring-boot-starter-parent as the parent in your pom.xml file.

The second option let us inherits and use the sensible defaults. To use Spring Boot starter parent, add the spring-boot-starter-parent as the parent in your pom.xml file.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.4.RELEASE</version>
</parent>

The version tag ensure that Spring Boot will get all verified dependencies for your project. Refer to the Maven or Initilzr for the latest release. In case your project is already using own corporate standard parent pom, you still have the way to use the benefit of the dependency management without using the spring-boot-starter-parent

<dependencyManagement>
    <dependencies>
        <dependency>
            <!-- Import dependency management from Spring Boot -->
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>2.1.4.RELEASE</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>

For more information, read our article Spring Boot Starter Parent

In this article, we discussed some commonly asked Spring Boot interview questions during a job interview. If you are preparing for your next interview, read our post on Spring Interview Questions.

14 thoughts on “Spring Boot Interview Questions”

  1. Cool. loved it.. I have followed all questions and answers and came up with production ready sprintboot template project. This template project can be easily used to get started with implmentation of business logic.

    thanks to you.

Comments are closed.