[Java development framework SpringBoot] automatic configuration principle

Why are there prompts when we are writing yml configuration or properties configuration? Why do you know which attributes need to be equipped? In other words, an error is reported after the wrong attribute is configured? What are these reasons?

In the SpringBoot startup class, there is a @EnableAutoConfigurationNote: Start automatic configuration . There is a detailed introduction in this article: @SpringBootApplication Annotation Detailed

Insert picture description here
To RabbitAutoConfigurationfor example
enterRabbitAutoConfiguration

Insert picture description here
Can see there is a:@EnableConfigurationProperties(RabbitProperties.class)注解 : Enable configuration RabbitProperties.classattributes of .

enterRabbitProperties.class

Insert picture description here
就能看到很多关于rabbitMQ的配置, The configuration here can be written in the configuration file .

to sum up

如果觉得不错,可以点赞+收藏或者关注下博主。感谢阅读!

Guess you like

Origin blog.csdn.net/weixin_42825651/article/details/109238343