I need to read all beans of class com.Foo
.
How I used to do it:
BeanFactory factory = new XmlBeanFactory(new ClassPathResource(file));
Map elements = BeanFactoryUtils.beansOfTypeIncludingAncestors((ListableBeanFactory) factory, com.Foo.class);
It turns out that XmlBeanFactory
is now deprecated. How do I read all beans of a given class in Spring 3.1 ?
edit: the new factory has to be able to load bean definition XML from any file, classpath or filesystem. Until now I used the Spring
org.springframework.core.io.Resource
interface and it worked pretty well (it has many implementations, for any kind of file)