2011-10-06 5 views
0

디렉토리를 특정 간격으로 수신해야하는 파일 채널 어댑터가 있습니다. 그리고 나는 다음과 같은 코드를 가지고있다. 내가 진짜 디렉토리 이름으로 directory="file:${SYS.com.abc.wls.workdir}/finalize/ 교체 하십시오 때스프링의 시스템 특성 구성

<file:inbound-channel-adapter id="fileAdapter" 
     directory="file:${SYS.com.abc.wls.workdir}/finalize/" queue-size="1000" 
    auto-startup="true" filename-pattern="*.txt"> 
<int:poller fixed-delay="500">   

</int:poller>  
</file:inbound-channel-adapter> 

는 (같은 directory="file:C:/temp/finalize/) 모든 작동합니다. 그러나 서버를 시작할 때 시스템 속성이 설정 중이지만 스프링이 시스템 속성을 감지하지 못합니다.

도와 주시겠습니까?

업데이트 :

내가 자리 표시 자

<beans:bean id="jobProperties" 
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"> 
    <beans:property name="properties"> 
     <beans:value> 
      job.group.commit.interval=5000 
     </beans:value> 
    </beans:property> 
    <beans:property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_FALLBACK" /> 
    <beans:property name="ignoreUnresolvablePlaceholders" 
     value="true" /> 
    <beans:property name="order" value="1" /> 
</beans:bean> 

에 대한 다음과 같은 구성을 제거했다 : directory="file:${SYS.com.abc.wls.workdir}/finalize/"에서 file:auto-create-directory="false"로 변경하고 지금은 다음과 같이 예외를 gettign있어,

by: java.lang.IllegalArgumentException: Source directory **[${SYS.com.abc.wls.workdir}\finalize] does not exist**. 
at org.springframework.util.Assert.isTrue(Assert.java:65) 
at org.springframework.integration.file.FileReadingMessageSource.onInit(FileReadingMessageSource.java:233) 
at org.springframework.integration.context.IntegrationObjectSupport.afterPropertiesSet(IntegrationObjectSupport.java:98) 
at org.springframework.integration.file.config.FileReadingMessageSourceFactoryBean.initSource(FileReadingMessageSourceFactoryBean.java:153) 
at org.springframework.integration.file.config.FileReadingMessageSourceFactoryBean.getObject(FileReadingMessageSourceFactoryBean.java:99) 
at org.springframework.integration.file.config.FileReadingMessageSourceFactoryBean.getObject(FileReadingMessageSourceFactoryBean.java:37) 
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport$2.run(FactoryBeanRegistrySupport.java:133) 
at java.security.AccessController.doPrivileged(Native Method) 
at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:131) 
... 63 more 

답변

1

다음과 같이 인식하는 스프링 엔티티를 선언해야합니다. 시스템 속성을 조정합니다. 전형적인 접근법은 PropertyPlaceHolderConfigurer을 Spring 설정에 넣는 것이다.

기본 모드는 SYSTEM_PROPERTIES_MODE_FALLBACK입니다. 즉 구성자가 보유하지 않은 값은 시스템 속성으로 검색됩니다. 모드는 setSystemPropertiesMode을 사용하여 재정의 할 수 있습니다.

+0

@ Johan Sjöberg. PropertyPlaceholderConfigure에서 를 SYSTEM_PROPERTIES_MODE_FALLBACK으로 설정해야한다는 뜻입니까? – nobody

+0

@ 아무도, 나는 더 명확하게 내 게시물을 편집했습니다. –

+0

나는 이미 그렇게 해왔다. 질문을 업데이트했습니다. – nobody