我想读取一个不是标准 spring xml 格式的外部配置文件,并基于该文件创建 FooBean(s)。
Spring BeanFactory 接口只能创建一个对象,我想返回零个或多个对象,具体取决于外部配置文件。
我应该在 FooBeansHolder 是持有 FooBean(s) 的虚拟类的情况下实现 FactoryBean 吗?还是应该在调用 getObject() 时实现 FactoryBean、ApplicationContextAware 并将 bean 注入 BeanFactory ?特别是在这种情况下,我对 SpringConfig 不感兴趣(请不要使用 @Bean)
依赖类请求将所有 FooBean(s) 注入其中:
@Autowired(required = true)
private FooBean[] foobeans;