1. Comparison of the configuration annotation @ConfigurationProperties to obtain the value and @Value to obtain the value
1. Both annotations can get the value of the configuration file, no matter whether the configuration file is yml or properties;
2. If you only need to get a certain value of the configuration file in a certain business logic, then use @Value;
3. If you need a special javaBean entity class to map with the configuration file, then use @ConfigurationProperties;
2. @ConfigurationProperties supports JSR303 for configuration file value verification, but @Value cannot
Add the @ConfigurationProperties annotation to a JavaBean, and add the @Validated annotation to verify the property value. For example:
If you want the format of an attribute value to be an email address, just add @Email to the attribute value.