Prepare Interview

Exams Attended

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Spring Boot Interview Questions and Answers

Freshers / Beginner level questions & answers

Ques 1. What is Spring Boot?

Spring Boot is an open source Java-based framework used to create a microservice. It is developed by Pivotal Team and is used to build stand-alone and production ready spring applications.

Is it helpful? Add Comment View Comments
 

Ques 2. Why to use Spring Boot?

You can choose Spring Boot because of the features and benefits it offers as given here:
  • It provides a flexible way to configure Java Beans, XML configurations, and Database Transactions.
  • It provides a powerful batch processing and manages REST endpoints.
  • In Spring Boot, everything is auto configured; no manual configurations are needed.
  • It offers annotation-based spring application.
  • Eases dependency management.
  • It includes Embedded Servlet Container.
  • Creates production ready microservices.

Is it helpful? Add Comment View Comments
 

Ques 3. Mention some advantages of Spring Boot.

Here are some major advantages of using spring-boot:
  • Helps you to create a stand-alone application, which can be started using java.jar.
  • It offers pinpointed started POMs to Maven configuration.
  • Allows you to Embed Undertow, Tomcat, or Jetty directly.
  • Helps you to configure spring whenever possible automatically.

Is it helpful? Add Comment View Comments
 

Ques 4. How to create a Spring Boot application using Spring Initializer?

It is an web application provided by Spring on its official website. However, you can also create Spring Boot project by entering project details.

Is it helpful? Add Comment View Comments
 

Ques 5. What are the ways to create Spring Boot project?

Basically, there are following four ways in which we can create Spring Boot Project :
  • Using Spring.io initializer.
  • Using Eclipse or any similar IDE and Maven simple project.
  • Using Spring Tool Suite.
  • Using CLI.

Is it helpful? Add Comment View Comments
 

Ques 6. What are the advantages of microservice?

Following are the major advantages of microservice:
  • It makes development fast and easy.
  • Compatible with all container.
  • Reduce production time.
  • It is a lightweight model that supports a major business application.

Is it helpful? Add Comment View Comments
 

Ques 7. Explain different types of dependency injection.

There are two types of dependency injection in Spring Boot. They are as follows:
  • Constructor based dependency injection: It is a technique in which one class object supplies the dependency of another object.
  • Setter-based dependency injection: It is a dependency injection in which the framework injects the primitive and string-based values using setter method.

Is it helpful? Add Comment View Comments
 

Ques 8. What are the commands to run and stop Spring Boot executable jar file?

You need to open cmd or shell window command and use
java -jar
To run application:
$ java -jar spring-boot-sample-0.0.1-SNAPSHOT.jar
To stop: 
Press ctrl+C

Is it helpful? Add Comment View Comments
 

Ques 9. What is the process that you need to follow to run Spring Boot application on the custom port?

In order to run a Spring Boot application, you require to put server.port property in application.properties. 

For example, server.port=8050

Is it helpful? Add Comment View Comments
 

Ques 10. Can you use Spring Boot with applications which are not using Spring?

No, it is not possible as Spring Boot is limited to Spring application only.

Is it helpful? Add Comment View Comments
 

Ques 11. What is the name of the configuration file which you can use in Spring Boot?

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

Is it helpful? Add Comment View Comments
 

Ques 12. How are properties defined in Spring Boot and where?

You can define properties in the application.properties file exists in the classpath.
Example: configure default DataSource bean
database.host=localhost

Is it helpful? Add Comment View Comments
 

Ques 13. Explain @RestController annotation in Spring Boot?

The @RestController annotation helps you to add @ResponseBody and @Controller annotations to the class to write RESTFul web service APIs.
You can also import org.springframework.web.bind.annotation package in your file.

Is it helpful? Add Comment View Comments
 

Ques 14. Where can you define properties in Spring Boot application?

You can define properties of Spring Boot into a file called application.properties. It helps you to create this file manually, or you can use Spring Initializer to create this file.

Is it helpful? Add Comment View Comments
 

Ques 15. What are the Spring Boot properties?

Spring Boot offers various properties which can be specified inside our project’s application.properties file. It helps you to set values like a server-port number, database connection configuration, etc.

Is it helpful? Add Comment View Comments
 

Ques 16. Explain Auto-Configuration in Spring Boot.

Auto-configuration is used to configure Spring application automatically based on dependencies of classpath parameter. It makes development faster and easier.

Is it helpful? Add Comment View Comments
 

Ques 17. How to enable logging in Spring Boot?

In order to enable debug logging, you can specify --debug while starting the application from the command prompt.

Is it helpful? Add Comment View Comments
 

Ques 18. Explain overriding default properties in Spring Boot application.

Spring Boot has lots of properties that can be easily overridden by specifying them in application.properties.

Is it helpful? Add Comment View Comments
 

Ques 19. What is the default package in Spring Boot?

A class without any package declaration is considered as a default package.

Is it helpful? Add Comment View Comments
 

Most helpful rated by users:

Related differences

NodeJS vs Spring BootSpring vs Spring BootSpring MVC vs Spring Boot

Related interview subjects

JUnit interview questions and answers - Total 24 questions
Spring Framework interview questions and answers - Total 53 questions
Java Design Patterns interview questions and answers - Total 15 questions
Core Java interview questions and answers - Total 306 questions
Tomcat interview questions and answers - Total 16 questions
Apache Wicket interview questions and answers - Total 26 questions
Java Applet interview questions and answers - Total 29 questions
JAXB interview questions and answers - Total 18 questions
JMS interview questions and answers - Total 64 questions
Log4j interview questions and answers - Total 35 questions
Struts interview questions and answers - Total 84 questions
RMI interview questions and answers - Total 31 questions
Apache Camel interview questions and answers - Total 20 questions
JDBC interview questions and answers - Total 27 questions
Java 11 interview questions and answers - Total 24 questions
JPA interview questions and answers - Total 41 questions
EJB interview questions and answers - Total 80 questions
GWT interview questions and answers - Total 27 questions
Kotlin interview questions and answers - Total 30 questions
Glassfish interview questions and answers - Total 8 questions
Google Gson interview questions and answers - Total 8 questions
JSP interview questions and answers - Total 49 questions
J2EE interview questions and answers - Total 25 questions
Apache Tapestry interview questions and answers - Total 9 questions
Java Swing interview questions and answers - Total 27 questions
Java Mail interview questions and answers - Total 27 questions
Hibernate interview questions and answers - Total 52 questions
JSF interview questions and answers - Total 24 questions
Java 8 interview questions and answers - Total 30 questions
Java 15 interview questions and answers - Total 16 questions
JBoss interview questions and answers - Total 14 questions
Web Services interview questions and answers - Total 10 questions
RichFaces interview questions and answers - Total 26 questions
Servlets interview questions and answers - Total 34 questions
Java Beans interview questions and answers - Total 57 questions
Spring Boot interview questions and answers - Total 50 questions
©2023 WithoutBook