0
스프링 4.x에서 나는 항상 로컬 파일에 접근하고 설정 변수를로드하는데 file:#{systemProperties['user.home']}
을 사용했다. 그러나 아주 오래된 프로젝트의 경우, Spring 1.x (1.2.7)를 사용해야하고, 이제는 같은 코드가 작동하지 않습니다. 또한 file:${systemProperties['user.home']}
으로 시도했지만 아무 것도하지 않았습니다. 환경이 자리 표시자를 해결할 수없는 것 같습니다. systemProperties
(오류 반환 섹션 참조)스프링 1.x로 시스템 속성에 접근하기
누군가가 내게 힌트를 줄 수 있습니까?
응용 프로그램 컨텍스트 추출물은
<bean id="props" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>file:{systemProperties['user.home']}/ldap/conf/ldapconfiguration.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="false" />
</bean>
오류가
Error creating bean with name 'propertyConfigurer' defined in class path resource [ApplicationContext.xml]: Cannot resolve reference to bean 'props' while setting bean property 'properties'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'props' defined in class path resource [ApplicationContext.xml]: Initialization of bean failed; nested exception is java.io.FileNotFoundException: ${systemProperties['user.home']}\ldap\conf\ldapconfiguration.properties (The system cannot find the path specified)
감사합니다 돌아왔다. 지리산 TOUSEK에 의해 제공
솔루션 :
<bean id="props"
class="org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="locations">
<list>
<value>file:${user.home}/ldap/conf/ldapconfiguration.properties</value>
</list>
</property>
<property name="ignoreResourceNotFound" value="false" />
작품! 대단히 감사합니다 !! – gioconno