Hi,
I'm relying on Spring's PropertyPlaceholderConfigurer for various
configuration settings in the system I'm developing. Now, I'm adding FTP
support to the system and want to embed FtpServer in my Spring config.
While the custom namespace handler provided by FtpServer gives a very
nice Spring configuration it doesn't work with
PropertyPlaceholderConfigurer. FtpServer already provides factories
which I could use in my Spring file (using factory-bean and
factory-method) but the XML quickly becomes very awkward.
What I've done is to make my own FactoryBeans for each factory in
FtpServer. My FactoryBeans simply extend the corresponding factory and
implements FactoryBean, e.g.:
public class ConnectionConfigFactoryBean extends ConnectionConfigFactory
implements FactoryBean {
public Object getObject() throws Exception {
return createConnectionConfig();
}
public Class getObjectType() {
return ConnectionConfig.class;
}
public boolean isSingleton() {
return false;
}
}
With these FactoryBeans my Spring config looks a lot less awkward and
allows me to use PropertyPlaceholderConfigurer.
I'm perfectly fine with maintaining these FactoryBeans in my own project
but I think that they could be useful to others too so it would be nice
if FtpServer could provide them.
WDYT? Should I open a JIRA issue for this?
--
Niklas Therning
www.spamdrain.net