In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)05/31 Report--
Today, I will talk to you about how to understand that the convention in SpringBoot is better than configuration. Many people may not know much about it. In order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.
Convention is better than configuration, and many people interpret it as: convention is greater than configuration, convention is better than configuration, habit is greater than configuration, and so on. But they all mean the same thing, not zero configuration. Or zero configuration is not completely no configuration, but through the convention to reduce the configuration.
Convention over configuration is a simple concept. Systems, class libraries, and frameworks should assume reasonable default values, rather than requiring unnecessary configuration. In most cases, you will find that using the default values provided by the framework will make your project more efficient.
Convention is better than configuration. It's not a new routine, a new technology, a new idea. Instead, it has always existed, and SpringBoot just magnifies it and really makes the convention better than the configuration.
For example, we are in the daily development process. If you have a xttblog table, then there may be a corresponding entity class for Xttblog. This is actually a kind of agreement.
In SpringBoot, when we import a spring-boot-starter-web. It will automatically import Spring MVC-related dependencies (including Jackson supported by Json and Hibernate Validator for data validation) and a built-in Tomcat container, which allows you to run a WEB project independently through the main method or the JAR package during the development phase.
SpringBoot convention, when you import spring-boot-starter-web, it is agreed that you are a web development environment. When you are in a web environment, it is agreed that you will use SpringMVC (goodbye to Struts2 and the like, because it is not born and is not as popular as SpringMVC). As for the others, it is agreed that you will need them, which will be imported by default. When you feel inappropriate, you can use fewer changes to meet your needs.
Spring has been promoting the design concept of "convention over configuration" since the annotated version of Spring. The introduction of annotations is to reduce some default configuration, and the introduction of annotations represents the beginning of simplified configuration, a fact that officials say is based on spring.
The SpringBoot convention reduces dependence in the form of starter, so many commonly used starter have been introduced one after another.
Convention is better than configuration. It is also reflected in our real life. For example, we agreed to drive on the right, we agreed to take chopsticks from the small right hand, and so on. It is the small "agreement" and great effect of SprigBoot that makes more and more people fall in love with it.
After reading the above, do you have any further understanding of how to understand the convention over configuration in SpringBoot? If you want to know more knowledge or related content, please follow the industry information channel, thank you for your support.
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.