I understand the difference between a BeanFactory
and an ApplicationContext
.
I am also aware that a BeanFactory instance can be created from xml files, which reside in the classpath or anywhere else in the file system. So, an XMLBeanFactory instance is created in such cases.
At the same time, I was digging into BeanFactory
documentation and stumbled upon this.
Normally a BeanFactory will load bean definitions stored in a configuration source (such as an XML document), and use the org.springframework.beans package to configure the beans. However, an implementation could simply return Java objects it creates as necessary directly in Java code. There are no constraints on how the definitions could be stored: LDAP, RDBMS, XML, properties file, etc. Implementations are encouraged to support references amongst beans (Dependency Injection).
So, does this mean that the bean definition can be in non-XML format as well? viz, LDAP, RDBMS, properties file etc? If yes, please provide an snippet of it. I am exclusively looking for BeanFactory only and not any ApplicationContext implementations.