Top 11 Spring Boot Interview Questions And Answers

 

1) What is Spring Boot?

Spring boot is a Spring module that offers Rapid Application Development to Spring framework. Spring module is used to create an application based on Spring framework which requires to configure few Spring files.


2) What are the advantages of Spring Boot?

Following are some of the key advantages of Spring Boot:

● It can easily create a stand-alone application, which can be started using java.jar.
● Helps you to configure spring whenever possible automatically.
● Allows you to Embed Undertow, Tomcat, or Jetty directly.
● It reduces the development time.
● Spring boot increases productivity.


3) What are the different features of Spring Boot?

Following are the features of Spring boot:

● Starter dependency
● Spring initializer
● Auto-configuration i.e. everything is auto configured in spring boot; no manual configurations are needed.
● Spring boot provides a powerful batch processing and manages REST endpoints.
● Eases dependency management.
● It offers annotation-based spring application.


4) Can we create micro services using spring boot?

Yes, spring Boot is an open source Java-based framework which is used to create a micro Service.


5) What is the use of @EnableAutoConfiguration annotation in spring boot?

In spring boot @EnableAutoConfiguration annotation is used to automatically configures the application based on the dependencies that have been added to the project.


6) How to define the entry point of spring boot application?

The entry point of the spring boot application is the class that contains @SpringBootApplication annotation and the main method.


7) What is the use of @ComponentScan annotation in spring boot?

In spring boot @ComponentScan annotation is used to automatically scans all the components included in the project.


8) What are Spring Boot Starters?

Spring Boot Starters are used to handle the dependency management which was earlier very difficult task for big projects. Example spring-boot-starter-data-jpa dependency need to be included in the project if project is using Spring and JPA for database access.


9) What are the different Spring Boot Starters?

Following are the different Spring Boot Starters:

Spring Boot Starter Actuator dependency: It is used to monitor and manage the application.

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

Spring Boot Starter Security dependency: It is used for Spring Security.

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

Spring Boot Starter web dependency: It is used to write a Rest Endpoints.

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

Spring Boot Starter Thyme Leaf dependency: It is used to create a web application.

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

Spring Boot Starter Test dependency: It is used for writing Test cases.

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


10) What are the different ways to create Spring Boot application using Maven?

Following are the different ways to create Spring Boot application using Maven:
● Spring Boot CLI
● Spring Starter Project Wizard
● Spring Initializr
● Spring Maven Project


11) What is Spring Actuator in Spring Boot?

Spring Actuator helps to see what is happening inside a running application. Spring Actuator provides easy access to features such as identifying beans, CPU usage, etc.


 

Related links:

 

Related #tags: