做以下配置即可
@Override public void addResourceHandlers(ResourceHandlerRegistry registry) { try { registry.addResourceHandler("/upload/**","/**") .addResourceLocations("classpath:/static/", "file:"+ ResourceUtils.getFile("classpath:").getParent()+"/upload/"); } catch (FileNotFoundException e) { e.printStackTrace(); } }