Menu Close

spring boot interview questions

What is Spring Boot?

  • Spring Boot is one of the Spring modules providing RAD(Rapid Application Development) functionality.
  • We can develop standalone spring based applications that you can just run because it needs very little spring configuration.

What are the advantages of spring boot?

  • It helps you to develop stand-alone application which can be started using java.jar file.
  • It offers pinpointed ‘started’ POMs to Maven configuration.
  • It allows you to Embed Undertow, Tomcat, or Jetty directly.
  • It helps you to configure spring whenever possible automatically.

What are the Spring boot annotations?

  • @EnableAutoConfiguration
  • @ComponentScan
  • @SpringBootApplication
  • @ImportAutoConfiguration
  • @AutoConfigureBefore
  • @AutoConfigureAfter
  • @AutoConfigureOrder
  • @Conditional

What are the features of Spring boot?

  • Starter dependency
  • Auto-configuration
  • Spring initialize

Commands used to run and stop Spring Boot executable jar file?

  • Open command or shell window
  • cmd/> java -jar
  • Example : $ java -jar myproject-0.0.1-SNAPSHOT.jar
  • To stop : press ctrl+C

What is Spring Boot starter? How is it useful?

  • Spring Boot has many starters.
  • They are a set of convenient dependency descriptors.
  • Starter allows you to include these descriptors in your pom.xml.
  • If you want to work with Spring MVC, you can include “spring–boot–starter–web” as a dependency in pom.xml

What is the configuration file name in spring boot?

  • The configuration file used in Spring Boot projects is called “”.
  • It is an important file which allows you to override your default configurations.

What is DevTools in Spring Boot?

  • Spring Boot DevTools helps you to increase the productivity of the developer.
  • So, you don’t require re-deploying your application every time you make the changes.
  • It allows the developer to reload changes without the need of restarting of the server.

What are the Components of Spring Boot?

  • Spring Boot Starter
  • Spring Boot autoconfiguration
  • Spring Boot Actuator
  • Spring Boot CLI

What is Actuator?

  • Spring Boot Actuator allows you to monitor and manage your application when you want to push it for the production.
  • It helps you to control your application by using HTTP endpoints.

What is Spring Boot Initilizr?

  • Spring Boot Initilizr is a Spring Boot tool to bootstrap Spring Boot or Spring Applications very easily.
  • Forms are:
    • Spring Boot Initilizr With Web Interface
    • Spring Boot Initilizr With IDEs/IDE Plugins
    • Spring Boot Initilizr With Spring Boot CLI
    • Spring Boot Initilizr With ThirdParty Tools

What is Spring Batch? How do you implement it using Spring Boot?

  • Spring Boot Batch provides reusable functions that are essential in processing large volumes of records, including logging/tracing, transaction management, and job processing statistics, job restart, skip, and resource management.
  • It also provides more advanced technical services and features that will enable extremely high-volume and high performance batch jobs though optimization and partitioning techniques.

What is FreeMarker Template?

  • FreeMarker is a Java-based Template Engine, originally focusing on dynamic web page generation with MVC software architecture.
  • The major advantage of using Freemarker is the complete separation of the Presentation layer and the Business Layer.

What is Starter dependency?

  • This feature aggregates common dependencies together.
  • For example, if you want to develop Spring MVC based RESTful services then instead of including Spring MVC JAR and Jackson JAR file into classpath you can just specify spring-boot-web-starter and it will automatically download both those JAR files.
  • Spring Boot comes with many such starter dependencies to improve productivity.

What is Auto-Configuration?

  • This is another awesome feature of Spring Boot which can configure many things for you.
  • For example, If you are developing Spring web application and Thymeleaf.jar is present on the classpath then it can automatically configure Thymeleaf template resolver, view resolver, and other settings.
  • A good knowledge of auto-configuration is required to become experienced Spring Boot developers.

What is Spring CLI?

  • This is another awesome feature of Spring Boot which really takes Spring development into next level.
  • It allows you to use Groovy for writing Spring boot application which means a lot more concise code.

How do you implement FreeMarker template using Spring Boot?

  • The Programmers can work on the application code while the designers can work on the html page design.
  • Finally using freemarker these can then be combined to give the final output page.

How to implement Exception Handling using Spring Boot?

  • Spring provides a very useful way to handle exceptions using ControllerAdvice.
  • We will be implementing a ControlerAdvice class which will handle all exceptions thrown by the controller class.

What is AOP? How to use it with Spring Boot?

  • During software development, functions that span multiple points of an application are called cross-cutting concerns.
  • These cross-cutting concerns differ from the applications main business logic.
  • Separating these cross-cutting concerns from the business logic is where aspect-oriented programming (AOP) comes into picture.

What is Apache Kafka? How to integrate it with Spring Boot?

  • Apache Kafka is a distributed publish-subscribe messaging system.
  • It is a scalable, fault-tolerant, publish-subscribe messaging system which enables us to build distributed applications.
  • It is an Apache Top Level project. Kafka is suitable for both offline and online message consumption.