Hi,
I'm testing a lot these days the spring intergration and I hit a problem.
I need to connect to 10 FTP servers. FTP server configurations are stored in db (hosts, users, passwords)
In the config file I have somethig like this:
Code:<bean id="ftpClientFactory" class="org.springframework.integration.ftp.session.DefaultFtpSessionFactory"> <property name="host" value="${host}"/> <property name="username" value="${user}"/> <property name="password" value="${password}"/> </bean> <ftp:inbound-channel-adapter id="ftpInbound" cache-sessions="false" channel="myChannel" session-factory="ftpClientFactory" filename-pattern="*.xml" auto-create-local-directory="true" delete-remote-files="false" remote-directory="/" local-directory="d:\temp"> </ftp:inbound-channel-adapter>
I do not want to declare all 10 adapters and factories in config file, so the only one solution that I've found until now is to do something like:
Code:for (DBConfiguration dbConfiguration:dbConfigurations ) { ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext( new String[] { "classpath:ftp-adapter.xml" }, false); setEnvironmentForDBConfiguration(applicationContext, dbConfiguration); //<--- I will not go in details here if not necessary applicationContext.refresh() ; }
There are other solutions to this problem ?
Thank you


Reply With Quote