Spring 4为有序自动装配集合提供支持。我认为3.2.9没有,即使它有所有的注释。
有人可以证实这个假设吗?
感谢。
答案 0 :(得分:0)
似乎3.2.9没有为@Autowired集合处理@Order,但通过@PostConstruct(或InitializingBean #afterPropertiesSet())方法实现此功能非常简单:
Collections.sort(myCollection, AnnotationAwareOrderComparator.INSTANCE);