File tree Expand file tree Collapse file tree 2 files changed +3
-5
lines changed
Book-RESTful-Service/src/main/java Expand file tree Collapse file tree 2 files changed +3
-5
lines changed Original file line number Diff line number Diff line change 55import org .springframework .context .annotation .ComponentScan ;
66
77@ SpringBootApplication
8- @ ComponentScan ("com.howtoprogram.book" )
8+ @ ComponentScan ({ "com.howtoprogram.book" , "com.howtoprogram.service" } )
99public class Application {
1010
1111 public static void main (String [] args ) {
Original file line number Diff line number Diff line change 11package com .howtoprogram .service ;
22
33import java .io .IOException ;
4- import java .nio .file .Files ;
5- import java .nio .file .Path ;
6- import java .nio .file .Paths ;
4+ import java .nio .file .*;
75
86import org .springframework .stereotype .Service ;
97import org .springframework .web .multipart .MultipartFile ;
@@ -20,7 +18,7 @@ public void store(MultipartFile file) {
2018 "Failed to store empty file " + file .getOriginalFilename ());
2119 }
2220 Files .copy (file .getInputStream (),
23- this .rootLocation .resolve (file .getOriginalFilename ()));
21+ this .rootLocation .resolve (file .getOriginalFilename ()), StandardCopyOption . REPLACE_EXISTING );
2422 } catch (IOException e ) {
2523 throw new StorageException ("Failed to store file " + file .getOriginalFilename (), e );
2624 }
You can’t perform that action at this time.
0 commit comments