728x90
PropertyPlaceholderConfigurer
can only parse placeholders in Spring configuration (XML or annotations). Is very common in Spring applications use a Properties
bean. You can access it from your view this way (assuming you are using InternalResourceViewResolver
):
<bean id="properties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list><value>classpath:config.properties</value></list>
</property>
</bean>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
<property name="exposedContextBeanNames">
<list><value>properties</value></list>
</property>
</bean>
Then, in your JSP, you can use ${properties.myProperty}
or ${properties['my.property']}
.
출처
https://stackoverflow.com/questions/3933862/how-to-use-property-from-property-file-specified-in-propertyplaceholderconfigure
'Dev' 카테고리의 다른 글
메이븐 로컬의 별도 Repository 설정 (0) | 2017.08.02 |
---|---|
최신프로젝트 생성 pom (0) | 2017.08.01 |
MyBatis vs JPA 프로젝트 진행 관련 질문 과 조언. (0) | 2017.07.12 |
책, 토비의 스프링 3.0 "1부 이해" - 기록하고 또 보기 (0) | 2017.07.08 |
jQuery Datepicker 랜더링 (0) | 2017.07.06 |