상세 컨텐츠

본문 제목

[Spring] property 파일 여러개 로딩하는 방법 두가지

지식

by 수다쟁이직딩이 2020. 12. 11. 14:26

본문

1. property에 리스트를 만들어 하나하나 넣어주는 경우

 <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

        <property name="locations" >

        <list>

        <value>classpath:/jdbc.properties</value>

        <value>classpath:/path.properties</value>

        </list>

        </property>

        <property name="fileEncoding" value="UTF-8" />

    </bean>

 

2. 같은 폴더 내 모든 properties 확장자명을 불러오는 경우

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">

        <property name="locations" value="classpath:/*.properties" />

        <property name="fileEncoding" value="UTF-8" />

    </bean>

'지식' 카테고리의 다른 글

윈도우 nodejs 2503, 2502 에러코드 발생시 대처법  (0) 2021.06.14

관련글 더보기