dependency injection - Java Weld CDI alternative Factory -
A factory to me in my production code, the factory should be fun in my test code. I have to apply to both the interface, which factories: public interface FtpTransferFactory {FtpTransfer createFtpTransfer (string host, string machine); } Production code: default public class implements FtpTransferFactoryImpl FtpTransferFactory {public FtpTransferFactoryImpl () {} @ Override public FtpTransfer createFtpTransfer (final String host, final String Machine) {return new FTP transfers ( ); // some real FTP transfer object}} Test code: @Alternative implements public square FtpTransferFactoryTestImpl FtpTransferFactory {@Override public FtpTransfer createFtpTransfer (String host , String machine) {return ...; // Some real FTP transfer objects, with different settings (test env)}} Beans located on soya / test / resources. In XML: & lt; Options & gt; & Lt; Classes & gt; Engine.FtpTransferFactoryTestImpl & lt; / Square & gt; & Lt; / Options & gt...