본문 바로가기
springBoot

스프링 서버 경로 구하기

by 뇽꾸리 2022. 6. 15.
반응형
//getRealPath() : 실제 톰캣이 돌아가고 있는 컴퓨터에서 그 곳의 절대 주소값
String rootPath = request.getSession().getServletContext().getRealPath("/"); 

//저장경로 
1 String uploadPath = rootPath + "upload" ;
2 String uploadPath = request.getServletContext().getRealPath("/upload");



 File path = new File("");
 System.out.println(path.getAbsolutePath());
 
 new File("").getAbsolutePath()+"/static/upload"
반응형

댓글