Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

1.

What are the most common Spring Boot CLI commands?

Answer»

-run, -TEST, -grap, -JAR, -war, -install, -uninstall, --init, -shell, -help.

To check the DESCRIPTION, run spring --help from the terminal.

Spring BOOT CLI Commands
2.

What is Spring Boot CLI and what are its benefits?

Answer»

Spring Boot CLI is a command-line interface that allows you to CREATE a spring-based java application USING Groovy.

Example: You don’t need to create getter and setter method or access modifier, return statement. If you use the JDBC template, it automatically loads for you.

3.

What is Spring Initializer?

Answer»

Spring Initializer is a web application that helps you to create an initial spring boot project structure and provides a maven or GRADLE file to build your CODE. It solves the PROBLEM of setting up a framework when you are STARTING a project from scratch.

4.

What are starter dependencies?

Answer»

Spring boot starter is a maven template that contains a collection of all the relevant transitive dependencies that are NEEDED to start a particular functionality.
Like we NEED to IMPORT spring-boot-starter-web dependency for CREATING a web APPLICATION.

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

How does a spring boot application get started?

Answer»

Just like any other Java program, a Spring BOOT APPLICATION MUST have a main method. This method serves as an ENTRY point, which invokes the SpringApplication#run method to bootstrap the application.

@SpringBootApplication public class MyApplication { public static void main(String[] args) { SpringApplication.run(MyApplication.class); // other STATEMENTS } }
6.

What is the purpose of using @ComponentScan in the class files?

Answer»

Spring BOOT application scans all the beans and package DECLARATIONS when the application initializes. You NEED to add the @ComponentScan annotation for your class file to SCAN your components added to your project.

7.

What does the @SpringBootApplication annotation do internally?

Answer»

The @SpringBootApplication ANNOTATION is EQUIVALENT to using @Configuration, @EnableAutoConfiguration, and @ComponentScan with their default attributes. Spring Boot enables the developer to use a single annotation instead of using multiple. But, as we know, Spring PROVIDED LOOSELY coupled features that we can use for each annotation as per our PROJECT needs.

8.

How does Spring Boot works?

Answer»

SPRING Boot automatically CONFIGURES your application based on the dependencies you have ADDED to the project by using annotation. The ENTRY point of the spring boot application is the class that contains @SpringBootApplication annotation and the main method.

Spring Boot automatically SCANS all the components included in the project by using @ComponentScan annotation.

9.

What is the starter dependency of the Spring boot module?

Answer»

Spring BOOT provides numbers of STARTER dependency, here are the most COMMONLY used -

  • Data JPA starter.
  • Test Starter.
  • Security starter.
  • Web starter.
  • Mail starter.
  • Thymeleaf starter.
10.

Why Spring Boot over Spring?

Answer»

Below are some key POINTS which spring boot OFFERS but spring doesn’t:

  • Starter POM.
  • Version Management.
  • Auto Configuration.
  • Component Scanning.
  • Embedded server.
  • InMemory DB.
  • Actuators

Spring Boot simplifies the spring FEATURE for the USER:

Spring vs Spring Boot
11.

What are the Spring Boot key components?

Answer»

Below are the four key COMPONENTS of SPRING-boot:

  • Spring Boot auto-configuration.
  • Spring Boot CLI.
  • Spring Boot STARTER POMs.
  • Spring Boot ACTUATORS.
12.

What are the advantages of using Spring Boot?

Answer»

The advantages of Spring Boot are listed below:

  • Easy to understand and develop spring applications.
  • Spring Boot is nothing but an existing FRAMEWORK with the addition of an embedded HTTP server and annotation CONFIGURATION which makes it EASIER to understand and FASTER the process of development.
  • Increases PRODUCTIVITY and reduces development time.
  • Minimum configuration.
  • We don’t need to write any XML configuration, only a few annotations are required to do the configuration.