Spring Boot Interview Questions

Spring Boot Interview Questions


1) What is Spring Boot?

Spring Boot is a Spring module which provides RAD (Rapid Application Development) feature to Spring framework.

It is used to create stand alone spring based application that you can just run because it needs very little spring configuration.

For more information click here.

2) What are the advantages of Spring Boot?

  • Create stand-alone Spring applications that can be started using java -jar.
  • Embed Tomcat, Jetty or Undertow directly. You don‘t need to deploy WAR files.
  • It provides opinionated ‘starter‘ POMs to simplify your Maven configuration.
  • It automatically configure Spring whenever possible.

For more information click here.

3) What are the features of Spring Boot?

  • Web Development
  • SpringApplication
  • Application events and listeners
  • Admin features

For more information click here.

4) How to create Spring Boot application using Maven?

There are multiple approaches to create Spring Boot project. We can use any of the following approach to create application.

  • Spring Maven Project
  • Spring Starter Project Wizard
  • Spring Initializr
  • Spring Boot CLI

For more information click here.

5) How to create Spring Boot project using Spring Initializer?

It is a web tool which is provided by Spring on official site. You can create Spring Boot project by providing project details.

For more information click here.

6) How to create Spring Boot project using boot CLI?

It is a tool which you can download from the official site of Spring Framework. Here, we are explaining steps.

Download the CLI tool from official site and For more information click here.

7) How to create simple Spring Boot application?

To create an application. We are using STS (Spring Tool Suite) IDE and it includes the various steps that are explaining in steps.

For more information click here.

8) What are the Spring Boot Annotations?

The @RestController is a stereotype annotation. It adds @Controller and @ResponseBody annotations to the class. We need to import org.springframework.web.bind.annotation package in our file, in order to implement it.

For more information click here.

9) What is Spring Boot dependency management?

Spring Boot manages dependencies and configuration automatically. You don‘t need to specify version for any of that dependencies.

Spring Boot upgrades all dependencies automatically when you upgrade Spring Boot.

For more information click here.

10) What are the Spring Boot properties?

Spring Boot provides various properties which can be specified inside our project‘s application.properties file. These properties have default values and you can set that inside the properties file. Properties are used to set values like: server-port number, database connection configuration etc.

For more information click here.

11) What are the Spring Boot Starters?

Starters are a set of convenient dependency descriptors which we can include in our application.

Spring Boot provides built-in starters which makes development easier and rapid. For example, if we want to get started using Spring and JPA for database access, just include the spring-boot-starter-data-jpa dependency in your project.

For more information click here.

12) What is Spring Boot Actuator?

Spring Boot provides actuator to monitor and manage our application. Actuator is a tool which has HTTP endpoints. when application is pushed to production, you can choose to manage and monitor your application using HTTP endpoints.

For more information click here.

13) What is thymeleaf?

It is a server side Java template engine for web application. It‘s main goal is to bring elegant natural templates to your web application.

It can be integrate with Spring Framework and ideal for HTML5 Java web applications.

For more information click here.

14) How to use thymeleaf?

In order to use Thymeleaf we must add it into our pom.xml file like:

 
  1. <dependency>    
  2. <groupId>org.springframework.boot</groupId>    
  3. <artifactId>spring-boot-starter-thymeleaf</artifactId>    
  4. </dependency>    

For more information click here.

15) How to connect Spring Boot to the database using JPA?

Spring Boot provides spring-boot-starter-data-jpa starter to connect Spring application with relational database efficiently. You can use it into project POM (Project Object Model) file.

For more information click here.

16) How to connect Spring Boot application to database using JDBC?

Spring Boot provides starter and libraries for connecting to our application with JDBC. Here, we are creating an application which connects with Mysql database. It includes the following steps to create and setup JDBC with Spring Boot.

For more information click here.

17) What is @RestController annotation in Spring Boot?

The @RestController is a stereotype annotation. It adds @Controller and @ResponseBody annotations to the class. We need to import org.springframework.web.bind.annotation package in our file, in order to implement it.

For more information click here.

18) What is @RequestMapping annotation in Spring Boot?

The @RequestMapping annotation is used to provide routing information. It tells to the Spring that any HTTP request should map to the corresponding method. We need to import org.springframework.web.annotation package in our file.

For more information click here.

19) How to create Spring Boot application using Spring Starter Project Wizard?

There is one more way to create Spring Boot project in STS (Spring Tool Suite). Creating project by using IDE is always a convenient way. Follow the following steps in order to create a Spring Boot Application by using this wizard.

For more information click here.

20) Spring Vs Spring Boot?

Spring is a web application framework based on Java. It provides tools and libraries to create a complete cutomized web application.

Wheras Spring Boot is a spring module which is used to create spring application project that can just run.

文章来自:https://www.cnblogs.com/vicky-project/p/9350903.html
© 2021 jiaocheng.bubufx.com  联系我们
ICP备案:鲁ICP备09046678号-3