Spring 3.2.9:支持有序的自动装配集合

时间:2015-10-07 14:47:12

标签: spring inversion-of-control

Spring 4为有序自动装配集合提供支持。我认为3.2.9没有,即使它有所有的注释。

有人可以证实这个假设吗?

感谢。

1 个答案:

答案 0 :(得分:0)

似乎3.2.9没有为@Autowired集合处理@Order,但通过@PostConstruct(或InitializingBean #afterPropertiesSet())方法实现此功能非常简单:

Collections.sort(myCollection, AnnotationAwareOrderComparator.INSTANCE);