【发布时间】:2015-11-22 00:18:51
【问题描述】:
我有一个 spring 组件,它有一个 @Autowired 构造函数,它从 @Value 注释中获取其参数。像这样:
@Component
public class MyImplClass implement MyInterface
...
public MyImplClass(@Value("${prop.name}") final String name, @Value("${prop.value}") final String value) {
...
}
...
在另一个类中,我像这样自动装配这种类型
@Autowired
protected MyInterface _myInterface;
现在我需要获取传递给构造函数的动态生成值(在运行时生成)的 MyInterface bean。我尝试使用AbstractBeanFactory,但这不起作用。我该怎么做?
【问题讨论】: