Non Static Factory
File: context.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd"> <beans> <bean id="nonStaticFactory" class="NonStaticFactory"/> <bean id="testBeanObtainedViaNonStaticFactory" factory-bean="nonStaticFactory" factory-method="getTestBeanInstance"/> </beans> File: Main.java import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; class Main { public static void main(String args[]) throws Exception { ApplicationContext ctx = new ClassPathXmlApplicationContext("context.xml"); TestBean testBeanObtainedViaStaticFactory = (TestBean) ctx .getBean("testBeanObtainedViaNonStaticFactory"); } } class NonStaticFactory { public TestBean getTestBeanInstance() { return new TestBean(); } } class TestBean { }