I\'m using Spring to inject JMS connection factory into my Java application. Since this factory is only required within the production environment, not while I\'m developing
factory-bean
/factory-method
doesn't work with null
, but a custom FactoryBean
implementation works fine:
public class NullFactoryBean implements FactoryBean {
public Void getObject() throws Exception {
return null;
}
public Class extends Void> getObjectType() {
return null;
}
public boolean isSingleton() {
return true;
}
}