Spring

xml파일에서 properties 파일을 사용하는 방법

개발자자자 2020. 1. 29. 21:30

해당 xml 파일에서  local.properties 파일에 있는 db.url 을 사용하고자 하면, 아래와같이 작성 후에

<beans:bean

                class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
               <beans:property name="Location"  

                     value="/WEB-INF/spring/config/properties/local.properties" />
                <beans:property name="fileEncoding" value="UTF-8"/>

  </beans:bean>

================================================================

 

 

${db.url} 이렇게 사용하면 된다.