preface
Spring Boot is a set of rapid development framework. With the continuous popularity of micro-service architecture applications, the mastery of Spring Boot development technology has become a required skill for developers. At the same time, Spring Boot’s open source ecological construction capability is very strong, providing many application components, so that Spring Boot has a rich use of third-party open source software.
Based on the above situation, Spring Boot has become a must-have question for interviews at large and medium-sized Internet companies.
This article will share the core of the interview with you based on the sorting out of some interview question banks of big factories
1. What is Spring Boot?
Spring Boot is a sub-project of Spring open source organization. It is a one-stop solution for Spring components. It mainly simplifies the difficulty of using Spring, saves heavy configuration, and provides various initiators for developers to get started quickly.
2. Spring Boot has the following advantages:
It’s easy to get started, improves development efficiency, and provides a faster and broader entry experience for Spring development. Out of the box, avoid cumbersome configuration. Provides a number of non-business features common to large projects, such as embedded servers, security management, operational data monitoring, health checks, and external configuration. There is no code generation, and no XML configuration is required. Avoid massive Maven imports and versioning conflicts.
What are the core annotations for Spring Boot? Which notes are it mainly composed of?
The annotation above the Boot class is @SpringBootApplication, which is the core annotation of SpringBoot. The main combination contains the following three annotations:
The annotation above the Boot class is @SpringBootApplication, which is the core annotation of SpringBoot. The main combination contains the following three annotations:
@springBootConfiguration: The @Configuration annotation is combined to realize the function of the Configuration file.
@enableAutoConfiguration: Enable the automatic configuration function or disable an automatic configuration option, such as data source automatic configuration: @SpringBootApplication(exclude{DataSourceAutoConfiguration.class})
@ComponentScan: Spring component scanning, due to the length of the problem, the following interview questions xiaobiao has been organized into a document and study notes, pay attention to the public number: Qilin bug, convenient for you to more easily intuitive view analysis, and technology learning.
4. What is JavaConfig?
5. What is the principle of Spring Boot automatic configuration?
How do you understand the Spring Boot configuration loading sequence?
7. What is YAML?
8. Can Spring Boot be configured using XML?
What is the Spring Boot core configuration file?
10. What are Spring Profiles?
11, How to run Spring Boot application on custom port?
12, How to implement Spring Boot application security?
13. Compare the pros and cons of Spring Security and Shiro?
What is a CSRF attack?
What is a monitor in Spring Boot?
16. How to disable THE security of endpoints in Spring Boot?
17. How do we monitor all Spring Boot microservices?
What are WebSockets?
19. What is Spring Data?
20. What is Spring Batch?
21. What is a FreeMarker template?
22. How to integrate Spring Boot and ActiveMQ?
What is Swagger?
24. Did you implement it with Spring Boot?
What is Apache Kafka?
The front and back ends are separated. How to maintain interface documents?
27. How do I reload changes on Spring Boot without restarting the server?
28. How to hot deploy the Spring Boot project?
29. Which Starter Maven dependencies do you use?
What is the use of spring-boot-starter-parent?
Spring-boot-starter -parent: spring-boot-starter-parent: spring-boot-starter-parent: spring-boot-starter-parent: spring-boot-starter
- The Java compiled version is defined as 1.8.
- Encoding in UTF-8 format.
- < span style = “box-sizing: border-box; color: RGB (74, 74, 74); line-height: 22px; font-size: 14px! Important; word-break: inherit! Important;”
- Perform the configuration of the packaging operation.
- Automated resource filtering.
- Automated plug-in configuration.
- Resource filtering for application.properties and application.yml, including configuration files for different environments defined by profiles, For example, application-dev.properties and application-dev.yml.
31. What is the difference between Spring Boot jar and ordinary JAR?
The jar that Spring Boot projects eventually package into is an executable JAR that can be run directly through the java-jar xxx.jar command. This jar cannot be relied on by other projects as a normal JAR, and even if it does, it cannot use its classes.
The Spring Boot JAR cannot be relied upon by other projects, mainly because it is structurally different from regular JARS. A regular jar package, unzipped, contains our code. A Spring Boot executable jar package, unzipped, contains our code in the \ boot-INF \classes directory, and therefore cannot be referenced directly. If you must, you can add configuration to the pom.xml file to package the Spring Boot project into two Jars, one executable and one referenceable.
What are the options for running Spring Boot?
1) Package with command or put in a container to run
2) Run the Maven/ Gradle plugin
3) Run the main method directly
33, How to use SpringBoot to implement paging and sorting?
Using Spring Boot to implement paging is simple. Using Spring Data-jPA, you can implement paged pass-to-repository methods.
How to realize session sharing in microservices?
In microservices, a complete project is divided into multiple different independent services, which are deployed independently on different servers, and their sessions are separated from the physical space. But often, we need to share sessions between different microservices. The common solution is Spring Session + Redis to achieve Session sharing. All microservices’ sessions are uniformly stored in Redis. When each microservice has related read and write operations on the session, it will operate the session on Redis. In this way, session sharing is realized. Spring Session is implemented based on the proxy filter in Spring, making session synchronization transparent and easy for developers.
How do I implement scheduled tasks in Spring Boot?
Scheduled tasks are also a common requirement. Spring Boot supports scheduled tasks mainly from the Spring framework.
There are two main ways to use Scheduled tasks in Spring Boot: using the @Scheduled annotation in Spring and using a third-party framework called Quartz.
The way to use @Scheduled in Spring is primarily through the @Scheduled annotation.
If Quartz is used, Job and Trigger are defined as Quartz.
conclusion
Spring Boot is a set of rapid development framework. With the continuous popularity of micro-service architecture applications, the mastery of Spring Boot development technology has become a required skill for developers. Due to the length of the problem, the above interview question xiaobian has been organized into a document and study notes, pay attention to the public number: Kirin bug, convenient for you to more easily intuitive view analysis, and technical learning.
That’s the end of the article!