A Java programmer who has been working for 3 years, encountered a problem with Spring Boot.
He has some understanding of this question, but the answer is not very good, I hope to refer to my master answer.
This question is: "How to understand Starter in Spring Boot".
For this question, look at the answers of ordinary people and experts.
Ordinary people:
Um. . . . . . . . . . . . .
Expert:
Starter is one of the four core functional features of Spring Boot. In addition, Spring Boot also has features such as automatic assembly and Actuator monitoring.
These features in Spring Boot are designed to allow developers to only care about business logic when developing enterprise-level applications based on the Spring ecosystem.
Reduce dependencies on configuration and external environments.
Among them, Starter is a startup dependency, and it has several main functions.
The Starter component takes the function as the latitude to maintain the version dependency of the corresponding jar package.
This allows developers to not need to worry about the error-prone details of these version conflicts.
- The Starter component will import all the jar package dependencies of the corresponding functions, avoiding the trouble caused by the developers introducing dependencies themselves.
Starter integrates the mechanism of automatic assembly, that is to say, after relying on the corresponding starter component in the program,
This component is automatically integrated into the Spring ecosystem, and the management of related beans is also based on the automatic assembly mechanism.
After relying on the Starter component, the externalized configuration that needs to be maintained for the corresponding functions of this component will be automatically integrated into Spring Boot.
We only need to maintain it in the application.properties file. For example, the starter of Redis only needs to be maintained in application.properties
Add the connection information of redis to the file and you can use it directly.
In my opinion, the Starter component almost perfectly embodies the concept of convention over configuration in Spring Boot.
In addition, Spring Boot officially provides many Starter components, such as Redis, JPA, MongoDB, and more.
However, the official does not necessarily maintain all middleware Starters, so for non-existing Starters, third-party components generally maintain one by themselves.
The biggest difference between the official starter and third-party starter components is the naming.
Officially maintained starters are prefixed with spring-boot-starter.
Starters maintained by third parties are suffixes ending with spring-boot-starter
This is also a manifestation of convention over configuration.
The above is my understanding of the problem.
Summarize
In the learning process of technology, I think "why" is more important than "what".
The benefit of learning in this way is a deeper understanding of the technology.
This question examines the "why", not difficult, the key lies in your own understanding.
If you like this article, remember to like and favorite.
If you want to get one-on-one interview guidance and interview materials, you can private message me.
Copyright notice: All articles in this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated. Please indicate the source forMic带你学架构
!
If this article is helpful to you, please help to follow and like, your persistence is the driving force for my continuous creation. Welcome to follow the WeChat public account of the same name to get more technical dry goods!
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。