如果在这样的结构中

我们在Controller中注入,但我们后续需要修改Oss时,比如从minioService改成AliyunService时,需要改动的代码很多。于是我们抽象出一个FileService,让controller只跟fileservice耦合,这样我没只需要在fileservice中来确定我们需要哪个类型

这里面注入一个storageService,通过bean注入来确定需要哪个service

接着定义一个configuration,将配置文件我们需要设置的类型读取,即可确定服务类型,再通过bean注入给fileservice(storage的两个实现类都不需要@Service)