我正在尝试@Autowired用于文件存储服务,但显然我做错了。
我目前正在尝试在 Eclipse 上使用 Spring Boot 创建文件上传服务。
@PostMapping("/upload")
public String onUpload(@RequestParam("file") MultipartFile file, CVtestForm cvForm, RedirectAttributes redirectAttributes) throws IOException {
@Autowired
StorageService storageService;
return "upload_show";
}
Run Code Online (Sandbox Code Playgroud)
我期待storageService连接到FileStorageService,它实现了它。