Spring
Apache Tomcat 외부 폴더 classpath 설정 방법
leechun
2021. 12. 21. 17:42
개요
Spring을 사용하면서 보통 *-context.xml, *-properties.xml 과 같은 설정파일은 src/main/resources 아래 위치하여 사용한다.
프로젝트를 war로 Export 하면 보통 /WEB-INF/classes/config/* 에 설정파일이 위치한다.
하지만, 설정파일 모두를 외부 특정 폴더로 이동시켜야 한다면, 톰캣의 외부 classpath 설정은 어떻게 할까?
상황 설명
예를 들어 src/main/resources 아래 *-context.xml, *-properties.xml 파일이 있고
Maven Build(Goals : clean package) 하면, 설정파일들을 외부 경로(C:/Project/Appserver/tomcat/app_config) 에 위치한다.
이런 경우 Tomcat의 외부 폴더를 classpath로 설정해야지 설정파일을 읽어서 정상적으로 동작할 수 있다.
방법
tomcat 설정 후 아래 사진과 같이 classpath를 설정한다.