首先在Springboot项目中,件一个java类,使用注解@Configuration ,则这个类是SpringBoot bean的创建的配置文件类,,这种配置文件类有两种写法 1.使用包扫描 ,创建bean2. 使用函数创建bean 1.通过包扫描,将包下所有注解类,注入到spring容器中 import org.springframework.context.annotation.ComponentScan; import org.springframework.context.anno…