0
我想要注入一个类generics
。春天 - 注入通用豆
比方说,我有类GenericClass<T>
,我想不必把它注射在两类:
@Autowired
private GenericClass<A> foo;
和
@Autowired
private GenericClass<B> foo;
我怎样才能做到这一点?我认为使用prototype scope
就足够了。
谢谢!
编辑:我使用Spring 4.另外,最好的解决方案是不要在@Configuration
中声明每个bean,如果它可能的话。