* let the simple @BeanListFactoryBean@ take the order of the collected beans into account
git-svn-id: svn+ssh://svn.synyx.de/var/svn/synyx/opensource/hera/trunk@6961 5a64d73e-33d6-4ccc-9058-23f8668ecac9
This commit is contained in:
@@ -15,10 +15,13 @@
|
||||
*/
|
||||
package org.synyx.hera.core.support;
|
||||
|
||||
import java.awt.List;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
import org.springframework.core.annotation.AnnotationAwareOrderComparator;
|
||||
|
||||
|
||||
/**
|
||||
@@ -30,6 +33,10 @@ import org.springframework.context.ApplicationContext;
|
||||
public class BeanListFactoryBean<T> extends AbstractTypeAwareSupport<T>
|
||||
implements FactoryBean {
|
||||
|
||||
private static final Comparator<Object> COMPARATOR =
|
||||
new AnnotationAwareOrderComparator();
|
||||
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -37,6 +44,9 @@ public class BeanListFactoryBean<T> extends AbstractTypeAwareSupport<T>
|
||||
*/
|
||||
public Object getObject() throws Exception {
|
||||
|
||||
List<T> beans = getBeans();
|
||||
Collections.sort(beans, COMPARATOR);
|
||||
|
||||
return getBeans();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user