SpringBoot should now be used by most companies, especially it is simplified to simplify the writing of many code in the form of configuration instead of XML, but what configuration items it has, it still takes some time to take a good look, so I finish finishing A SpringBoot feature configuration, I hope it is useful to you.
I have seen a configuration item @SpringBootApplication
is also a configuration that must be added to the startup item.
In fact, this configuration item has contained a lot of configuration items, as shown in the figure:
These three are meta -annotations.
TARGET modifies the range of the objects modified by Annotion, the period of the life of the Retention modification of the annotation of the annotation, and the Documented explaining that this annotation will be recorded by the Javadoc tools. Since these generally do not move it, just pass by
@SpringBootConfiguration is to indicate that the class is a configuration class. It can be seen that it is the role of @Configuration, but it belongs to SpringBoot and @Configuration belongs to Spring.
is because the class of AutoConfigurationimportselector can achieve the condition that the condition is loaded (because the autoConfigure provides a lot of conditions, which can be seen below) to be loaded into the current IOC container with @Configuration.
ORG.SpringFramework.Boot.autoConfigure also provides a lot of annotations. When using this annotation, it will be registered in the container only when it meets their respective conditions.
Since there are a lot, it is not used. Here is only some commonly used or used by yourself.
- ConditiononBean refers to the existence of Bean in the container to take effect. ConditiononMissBean corresponds to no effect.
- ConditiononClass means that when ClassPath exists in this class, the ConditiononMissClass is also effective when it does not exist when it does not exist.
- ConditionOnExpression refers
- ConditionalonProperty (name = “”,, havingvalue = “”) The parameter setting values in the set settings
- ConditionalonsingLecandidate refers to a bean that exists in the container
or above is a record notes for personal learning. It is not easy to knock on your hands.
also welcome the guidance of Dasiu.