카테고리 없음
[Spring] 외부 프로퍼티 파일 여러개 읽어들이기
개발하는개발자
2021. 3. 27. 15:00
반응형
앞서 외부 프로퍼티 파일을 읽어 bean으로 등록해보았습니다.
[Spring] 외부 프로퍼티 파일 읽어오기
applicationContext.xml 파일에서 아래와 같이 작성합니다. 위 코드의 역할은 해당 위치에 있는 파일을 읽은 후 에 명시된 class파일에 setter를 이용하여 properties의..
olsh1108o.tistory.com
외부 프로퍼티 파일을 여러개 읽어올 때 똑같은 방식으로 등록한다면 하나의 파일만 읽어들이는 문제가 발생한다.
<context:property-placeholder location="file:///C:\...파일경로\propertiesFileName1.properties" />
<context:property-placeholder location="file:///C:\...파일경로\propertiesFileName2.properties" />
이를 해결하는 방법은..
<context:property-placeholder order="1" ignore-unresolvable="true" location="file:///C:\...파일경로\propertiesFileName1.properties" />
<context:property-placeholder order="2" ignore-unresolvable="true" location="file:///C:\...파일경로\propertiesFileName2.properties" />
[ order="2" ignore-unresolvable="true" ]를 추가하여 문제를 해결할 수 있다.
반응형