In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
How to understand spring boot starter, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain for you in detail, people with this need can come to learn, I hope you can gain something.
Spring boot stater:
Native spring boot systems contain many default starter. Such as rabbit,jdbc and so on. It's all stated in spring-boot-autoconfigure. There is a corresponding XXXAutoConfiguration declaration in the corresponding spring.factories. When the system starts, it will actively load the qualified Configuration to complete the initialization.
Automatic configuration, bean configuration based on java code, can be used together with @ Configuration,@Bean to create a java code-based configuration instead of the corresponding xml configuration.
In the XXXAutoConfiguration class, some instances are automatically created and handed over to the spring container to complete the automatic registration of bean.
Automatically configure conditional dependencies. There are some commonly used conditional dependency annotations in Springboot:
1.@ConditionOnBean, which is instantiated only if a bean exists in the current context.
2.@ConditionOnClass, which is instantiated only if a class is on the classpath.
3.@ConditionOnExpression, which is instantiated only when the expression is true.
4.@AutoConfigureAfter, instantiate the bean after the automatic configuration of the bean
5.@AutoConfigureBefore, instantiate a bean before completing its automatic configuration.
6.@ConditionalOnProperty, according to the properties of the configuration file to determine whether to load the instantiated bean. MatchIfMissing, when the property is true, the configuration file is missing the corresponding property value. This bean is also instantiated.
If you want to extend a class yourself, and there is already a default AutoConfiguration, you can customize excludeAutoConfiguration to exclude the system's default XXXAutoConfiguration class.
Customize the implementation class of EnvironmentPostProcessor, then find the PropertySource that contains spring.autoconfigure.exclude [0], and add an exclusion to configure XXXAutoConfiguration. Then initialize the system with the custom AutoConfiguration.
Is it helpful for you to read the above content? If you want to know more about the relevant knowledge or read more related articles, 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.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.