Roman Pichlík opened SPR-5574 and commented
Let suppose that there are beans of a given type T and these beans are marked by interface Ordered or annotation Order. It does make really sense to preserve their order according to Ordered/Order marker if they are collected. See following code for illustration.
@Component
@Order(value=1)
public class BusinessServiceA implements BusinessService{}
@Component
@Order(value=2)
public class BusinessServiceB implements BusinessService{}
@Component
public class ServiceRegistry {
@Autowired
public List<BusinessService> services;
}
assertThat(services.get(0).getClass(), is(BusinessServiceA.class));
assertThat(services.get(1).getClass(), is(BusinessServiceB.class));
Issue Links:
Referenced from: commits 4a9af23
15 votes, 15 watchers
Roman Pichlík opened SPR-5574 and commented
Let suppose that there are beans of a given type T and these beans are marked by interface Ordered or annotation Order. It does make really sense to preserve their order according to Ordered/Order marker if they are collected. See following code for illustration.
@Component@Order(value=1)public class BusinessServiceA implements BusinessService{}
@Component@Order(value=2)public class BusinessServiceB implements BusinessService{}
@Componentpublic class ServiceRegistry {
@Autowiredpublic List<BusinessService> services;
}
assertThat(services.get(0).getClass(), is(BusinessServiceA.class));
assertThat(services.get(1).getClass(), is(BusinessServiceB.class));
Issue Links:
@Ordervs@Priorityvs@DependsOnReferenced from: commits 4a9af23
15 votes, 15 watchers