In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly explains the "2021 Spring Boot interview questions and answers", the content of the explanation is simple and clear, easy to learn and understand, the following please follow the editor's ideas slowly in depth, together to study and learn "what are the 2021 Spring Boot interview questions and answers?"
1. Q: what is Spring Boot?
A: with the addition of new features, spring is becoming more and more complex. If we have to start a new spring project, we have to add paths or add Maven dependencies to configure the application server or add spring configuration, so to start a new spring project, we have to start everything all over again.
Spring Boot is to solve this problem, Spring Boot is on the spring framework, started with spring, we avoided all the boilerplate code and configuration that we had to do before. Therefore, Spring Boot can help us to make more robust use of existing Spring capabilities with minimal effort.
- -
2. Q: what advantages does Spring Boot have?
A: reduce development and testing time and effort; use JavaConfig to help avoid using XML; to avoid a large number of Maven imports and various version conflicts; start development quickly by providing default values.
- -
3. Q: what is the monitor in Spring Boot?
A: Spring boot actuator is one of the important functions in the spring startup framework. The Spring boot Monitor helps you access the current status of running applications in a production environment. There are several indicators that must be checked and monitored in the production environment. Even though some external applications may be using these services to trigger alert messages to relevant people. The monitor module exposes a set of REST endpoints that can be accessed directly as HTTP URL to check status.
- -
4. Q: what are the ways to run Spring Boot?
Answer: (1) package command or run in a container; (2) run with Maven/ Gradle plug-in; (3) execute main method directly.
- -
5. Q: how do I run a Spring Boot application on a custom port?
Answer: 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 only users with the ACTUATOR role can access them. Security is implemented using standard HttpServletRequest.isUserInRole methods. We can use it to disable security. It is recommended that security be disabled only if the enforcement endpoint is accessed behind the firewall.
- -
7. Q: how to use Spring Boot to implement exception handling?
Answer: Spring provides a very useful way to handle exceptions using ControllerAdvice. We handle all the exceptions thrown by the controller class by implementing a ControlerAdvice class.
- -
8. Q: how to integrate Spring Boot and ActiveMQ?
A: for integrating Spring Boot and ActiveMQ, we use dependencies. It requires very little configuration and no boilerplate code.
- -
9. Q: how do I use Spring Boot for paging and sorting?
Answer: using Spring Boot to implement paging is very simple. Using Spring Data-JPA, you can implement the method of passing pageable to the repository.
- -
Q: how do we monitor all Spring Boot microservices?
A: Spring Boot provides monitor endpoints to monitor the metrics of individual microservices. These endpoints are useful for getting information about applications (such as whether they are started) and whether their components (such as databases, etc.) are functioning properly. However, one of the main drawbacks or difficulties of using the monitor is that we have to open the knowledge points of the application separately to understand its status or health. Imagine a micro-service involving 50 applications, and the administrator would have to hit the execution terminals of all 50 applications. To help us deal with this situation, we will use the open source project located in. It is built on top of Spring Boot Actuator and provides a Web UI that enables us to visualize metrics for multiple applications.
Thank you for your reading, the above is the content of "2021 Spring Boot interview questions and answers". After the study of this article, I believe you have a deeper understanding of the 2021 Spring Boot interview questions and answers, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.