hi
I'm building a dynamic inbound sftp route based on the example of the outbound-ftp, i also created a parent-child context so that the dynamic context is a child of the main.
the issue that i'm facing now is that the child-context does not contains the properties that are loaded in the parent.
this is in the main:
Code:
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:/general.properties</value>
<value>classpath:/mail.properties</value>
</list>
</property>
</bean>
and:
<bean id="channelResolver" class="com.x.y.SftpResolver" />
<int:channel id="toDynRouter" />
<int:router input-channel="toDynRouter" ref="channelResolver" method="resolve" />
where the SftpResolver implements ApplicationContextAware, to know about the main context.
in the child context i have this:
Code:
<context:property-placeholder/>
<bean id="mySftpFactory" class="org.springframework.integration.sftp.session.DefaultSftpSessionFactory">
<property name="host" value="${host}"/>
<property name="port" value="${port}"/>
<property name="user" value="${user}"/>
<property name="password" value="${password}"/>
</bean>
<int-sftp:inbound-channel-adapter id="mySftpInbondAdapter"
session-factory="mySftpFactory"
remote-directory="${remote.dir}" charset="UTF-8"
local-directory="file:${local.dir}/${clientId}"
delete-remote-files="false" filter="myRawFileFilter">
</int-sftp:inbound-channel-adapter>
- The property ${local.dir} comes from general.properties file in the main-context.
- The 'resolve' method is similar to the out-bound ftp example. i fetch the other properties from DB and add them to StandardEnvironment properties.
This is even working
(when i remove the property local.dir...)
- In debug mode, i've noticed that the appCtx.getEnvironment() holds only system env. props. ([systemProperties,systemEnvironment])
so that:
appCtx.getEnvironment().getProperty("os.name") returns (java.lang.String) Windows 7
but:
appCtx.getEnvironment().getProperty("local.dir") returns null
what else should i do in order to have access to the properties from the child context?
Thanks!