diff --git a/plugin-core/src/main/java/org/synyx/plugin/core/support/BeanListBeanFactoryPostProcessor.java b/plugin-core/src/main/java/org/synyx/plugin/core/support/BeanListBeanFactoryPostProcessor.java index 3e0bb7e..0d6d77d 100644 --- a/plugin-core/src/main/java/org/synyx/plugin/core/support/BeanListBeanFactoryPostProcessor.java +++ b/plugin-core/src/main/java/org/synyx/plugin/core/support/BeanListBeanFactoryPostProcessor.java @@ -1,6 +1,6 @@ package org.synyx.plugin.core.support; -import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; @@ -8,11 +8,8 @@ import java.util.Map; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.springframework.beans.BeansException; -import org.springframework.beans.factory.BeanFactory; -import org.springframework.beans.factory.FactoryBean; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.beans.factory.config.BeanFactoryPostProcessor; -import org.springframework.beans.factory.config.BeanPostProcessor; import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.beans.factory.config.ListFactoryBean; import org.springframework.beans.factory.config.RuntimeBeanReference; @@ -20,11 +17,30 @@ import org.springframework.beans.factory.support.AbstractBeanDefinition; import org.springframework.beans.factory.support.BeanDefinitionBuilder; import org.springframework.beans.factory.support.BeanDefinitionRegistry; import org.springframework.beans.factory.support.ManagedList; -import org.springframework.util.StringUtils; import org.synyx.plugin.core.PluginRegistry; /** + * Simple {@link BeanFactoryPostProcessor} to autocreate lists of the configured + * {@code lists} property. The post processor will register + * {@link ListFactoryBean}s for each list named with the given key containing + * all beans of the {@link org.springframework.context.ApplicationContext} + * implementing the interface defines as lists value. E.g.: + * + *
+ * <bean class="org.synyx.plugin.core.support.BeanListFactoryPostProcessor"> + * <property name="lists"> + * <map> + * <entry key="beanName" value="org.synyx.plugin.core.Plugin" /> + * </map> + * </property> + * </bean> + *+ * + * This would register all Spring beans implementing the + * {@link org.synyx.plugin.core.Plugin} interface in a list bean with the name + * {@coder beanName}. + * * @author Oliver Gierke - gierke@synyx.de */ public class BeanListBeanFactoryPostProcessor implements @@ -35,6 +51,8 @@ public class BeanListBeanFactoryPostProcessor implements private Map
- * We traverse the entire {@link BeanFactory} hierarchy to lookup beans.
- *
- * @param beanFactory
- * @param type
- * @return
- */
- private List