factory-bean/
factory-method不适用于
null,但是自定义
FactoryBean实现的效果很好:
public class NullFactoryBean implements FactoryBean<Void> { public Void getObject() throws Exception { return null; } public Class<? extends Void> getObjectType() { return null; } public boolean isSingleton() { return true; }}<bean id="jmsConnectionFactory" class = "com.sample.NullFactoryBean" />
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)