Spring boot recommends annotation configuration, which is to add before the class@Configuration
If you want to refer to other configuration classes, for @Import(xxx.class)example, a is a configuration class and b is also a configuration class, and b refers to a, which is written @Import(a.class)on the configuration class b
@BeanAnnotation, used for the method under the configuration class (currently only this), its role is to turn all the methods under the configuration class into bean components and add them to the ioc container
The ioc container is used to manage various components. The container contains bean components that are their dependencies.
@BeanIt defaults to singleton mode. We can modify its mode by modifying its scope value. What is the model? We only need to know the single case and multiple cases. Other, no
@BeanThe id is the name of the method under this annotation. We can use this id combined with @Autowired annotation to inject configuration metadata into the corresponding member variable
配置元数据? That is, the data returned by the return we wrote under the @Bean method
@RestControllerIt's actually a web @Controller. Let spring think it can handle incoming web requests
@RequestMappingThe annotation provides routing information, which can tell any http request through its path should match the method under the annotation. Then by @RestControllerreturning the result to the request page