根据@Juan的答案,创建了一个帮助程序来包装不自动接线的bean:
public static <T> FactoryBean<T> preventAutowire(T bean) { return new FactoryBean<T>() { public T getObject() throws Exception { return bean; } public Class<?> getObjectType() { return bean.getClass(); } public boolean isSingleton() { return true; } };}...@Beanstatic FactoryBean<MyBean> myBean() { return preventAutowire(new MyBean());}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)