前提是你要有一个springboot工程:https://blog.csdn.net/qq_44705486/article/details/91357332 方式一:@Bean+@Configuration 方式二: