做了以下教程https://spring.io/guides/gs/uploading-files/ 现在我希望能够将其部署到glassfish 4.1。问题是我无法进入暴露的休息服务
我的申请类:
package de.awinta.kti.cms;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
return application.sources(Application.class);
}
}
我的休息室:
@RestController
@RequestMapping("/files")
public class FileUploadController {
//private final StorageService storageService;
@Autowired
public FileUploadController() {
// this.storageService = storageService;
}
@RequestMapping("/upload")
public String handleFileUpload(@RequestParam("file") MultipartFile file,
RedirectAttributes redirectAttributes) {
//storageService.store(file);
//redirectAttributes.addFlashAttribute("message",
// "You successfully uploaded " + file.getOriginalFilename() + "!");
System.out.println("File uplaoded succesfully");
return "asda";
}
@ExceptionHandler(Exception.class)
public ResponseEntity handleStorageFileNotFound(Exception exc) {
return ResponseEntity.notFound().build();
}
}
有什么想法吗?