Coding With Fun
Home Docker Django Node.js Articles FAQ

The latest Spring Boot interview questions and answers for 2021


May 31, 2021 Article blog



Spring Boot interview question is a must-take in the java interview, today's small editor for you to organize the 2021 latest Spring Boot interview questions, these are mandatory interview questions, we have to take a good look!

 The latest Spring Boot interview questions and answers for 20211

-----------------------------------------------------------------------------------------------------------------------------------------

1. Q: What is Spring Boot?

A: Spring is becoming more and more complex as new features increase. If we have to start a new spring project, we have to add a path or add Maven dependencies to configure the application server or add a spring configuration, so to start a new spring project, we have to start doing everything again.

Spring Boot is the solution to this problem, Spring Boot is on the spring framework, using spring boot, we avoided all the boilerplate code and configuration that we had to do before. As a result, Spring Boot helps us use our existing Spring features more robustly with minimal effort.

-----------------------------------------------------------------------------------------------------------------------------------------

2. Q: What are the advantages of Spring Boot?

A: Reduce development, test time, and effort; use JavaConfig to help avoid XML; avoid large numbers of Maven imports and various version conflicts; and get started quickly by providing default values.

-----------------------------------------------------------------------------------------------------------------------------------------

3, Q: What is the monitor in Spring Boot?

A: Spring boot actuator is one of the most important features in the spring launch framework. T he Spring boot monitor helps you access the current state of running applications in your production environment. S everal metrics must be checked and monitored in a production environment. E ven if some external applications may be using these services to trigger alert messages to related people. The monitor module exposes a set of REST endpoints that can be accessed directly as HTTP URLs to check the status.

-----------------------------------------------------------------------------------------------------------------------------------------

4, Q: What are the ways to run Spring Boot?

A: (1) Pack with commands or run in a container, (2) run with Maven/Gradle plug-ins, and (3) run directly with the main method.

-----------------------------------------------------------------------------------------------------------------------------------------

5, Q: How do I run the Spring Boot application on a custom port?

A: In order to run the Spring Boot application on a custom port, you can specify the port in application.properties. server.port = 8090

-----------------------------------------------------------------------------------------------------------------------------------------

6, Q: How do I disable Actuator endpoint security in Spring Boot?

A: By default, all sensitive HTTP endpoints are secure and accessible only to users with actUATOR roles. S ecurity is implemented using the standard HttpServletRequest.isUser InRole method. W e can use to disable security. Security is recommended only if the execution agency endpoint is accessed behind a firewall.

-----------------------------------------------------------------------------------------------------------------------------------------

7, Q: How to use Spring Boot for exception handling?

A: Spring provides a very useful way to handle exceptions with ControllerAdvice. We handle all exceptions thrown by the controller class by implementing a ControlErAdvice class.

-----------------------------------------------------------------------------------------------------------------------------------------

8. Q: How do I integrate Spring Boot and ActiveMQ?

A: We use dependencies for integrating Spring Boot and ActiveMQ. It requires very little configuration and does not require sample code.

-----------------------------------------------------------------------------------------------------------------------------------------

9, Q: How do I use Spring Boot to achieve paging and sorting?

A: Paging with Spring Boot is easy. Spring Data-JPA enables a paginable delivery to the repository method.

-----------------------------------------------------------------------------------------------------------------------------------------

10, Q: How do we monitor all Spring Boot microservices?

A: Spring Boot provides monitor endpoints to monitor metrics for individual microseries. T hese endpoints are useful for getting information about applications, such as whether they are started, and whether their components, such as databases, are functioning properly. H owever, one of the main drawbacks or difficulties with using monitors is that we have to open the knowledge points of the application separately to understand its status or health. I magine a microservice involving 50 applications, and the administrator will have to hit the execution terminal for all 50 applications. T o help us deal with this situation, we will use the open source project located in . Built on Spring Boot Actuator, it provides a web UI that allows us to visualize metrics across multiple applications.


Well, the above is the latest Spring Boot interview questions and answers for 2021, I hope we can all have a good grasp, but Spring Boot master how to still have to be in the actual project to get a better embodiment, we can learn "SpringBoot project hands-on" course to get more practical experience.