In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 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.
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.