2018년 2월 6일 화요일

Spring 환경변수 세팅방법

1 properties.xml 설정

<beans profile="dev">
<context:property-placeholder location="classpath*:properties/dev.properties" />
<bean id="applicationProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="location" value="classpath:properties/dev.properties" />
</bean>
<util:properties id="config" location="classpath:/properties/dev.properties"/>
</beans>



2 datasource.xml 에서 config 를 사용해서 값 가져오는 방법

<property name="driverClassName" value="#{config['jdbc.driver']}" />

댓글 없음:

댓글 쓰기