Spring Boot Interview Questions

spring boot interview

1. What is the use of Spring Boot ?

  • Spring Boot help you develop Spring application as quickly as possible.
  • Spring Boot is a Spring module which provides RAD (Rapid Application Development) feature to Spring framework.
  • There is absolutely no requirement for XML configuration.

2.Advantages of Spring Boot ?

  • Make it easier to get started with spring developer.
  • Minimize the amount of manual configuration.
  • Perform auto-configuration based on props files and JAR classpath
  • Help to resolve dependency conflict (Maven or Gradle)
  • Provide an embedded HTTP server so you can get started quickly.
  • It is very easy to develop Spring Based applications with Java or Groovy.
  • It reduces lots of development time and increases productivity.
  • It avoids writing lots of boilerplate Code, Annotations and XML Configuration.
  • It is very easy to integrate Spring Boot Application with its Spring Ecosystem like Spring JDBC, Spring ORM, Spring Data, Spring Security etc.
  • It follows “Opinionated Defaults Configuration” Approach to reduce Developer effort
  • It provides Embedded HTTP servers like Tomcat, Jetty etc. to develop and test our web applications very easily.
  • It provides CLI (Command Line Interface) tool to develop and test Spring Boot(Java or Groovy) Applications from command prompt very easily and quickly.
  • It provides lots of plugins to develop and test Spring Boot Applications very easily using Build Tools like Maven and Gradle
  • It provides lots of plugins to work with embedded and in-memory Databases very easily.

3. What is the difference between Spring boot and Spring?

Ans will update soon

4. Why we are going over Spring boot than Spring?

Ans will update soon

5. What is @SpringBootApplication?

  • @SpringBootApplication is composed of the following annotations:
  • @Configuration -> Able to register extra beans with @Bean or import other configuration classes
  • @EnableAutoConfiguration -> Enables Spring Boot’s auto-configuration supports
  • @ComponentScan -> Enables Component scanning of current package(package where @SpringBootApplication resides ). Also Recursively scan sub-packages.

@SpringBootApplication is a convenience annotation that adds all of the following:

@Configuration tags the class as a source of bean definitions for the application context.

@EnableAutoConfiguration tells Spring Boot to start adding beans based on classpath settings, other beans, and various property settings.

Normally you would add @EnableWebMvc for a Spring MVC app, but Spring Boot adds it automatically when it sees spring-webmvc on the classpath.

This flags the application as a web application and activates key behaviors such as setting up a DispatcherServlet.

@ComponentScan tells Spring to look for other components, configurations, and services in the hello(package where this anntonationn is mentined) package, allowing it to find the controllers.

By default, Spring Boot will enable JPA repository support and look in the package (and its subpackages) where @SpringBootApplication is located.

If your configuration has JPA repository interface definitions located in a package not visible, you can point out alternate packages using @EnableJpaRepositories and its type-safe basePackageClasses=MyRepository.class parameter.

Spring Boot tries to auto-configure a DataSource if spring-data-jpa is in the classpath by reading the database configuration from application.properties file.

6. What is the use of SpringApplication class?

Spring Boot class to bootstrap our application. It starts auto-configured tomcat web server when Spring application is started.

7. What is Spring Boot Starters? What are starters used in your project?

  • Collection of maven dependencies
  • Reduces the amount of maven configuration
  • Save the developers from having to list all the dependencies
  • Make sure you have compatible version
  • Support lot of Starters

8. Spring Boot – How to use Hikari DataSource for connection pooling?

Ans will update soon

9.What is Spring Boot Actuator?

  • Exposes endpoints to monitor and manage your application.
  • Help to check the application health.
  • Provide application metrics.
  • Simply add dependency to your POM file.
  • REST endpoints are automatically added to your application.
  • Note: No need to write additional code! You get new REST endpoints for FREE!

About Manohar

I, Manohar am the founder and chief editor of ClarifyAll.com. I am working in an IT professional.

View all posts by Manohar →

2 Comments on “Spring Boot Interview Questions”

  1. Hi to every body, it’s my first go to see of this webpage; this
    webpage contains remarkable and really good stuff designed for
    visitors.

Leave a Reply