package com.kohls;
public class Foo {
@Override
public String toString() {
// TODO Auto-generated method stub
return "Inside Foo";
}
}
FooFactory.java
package com.kohls;
public class FooFactory {
private static Foo foo;
public static Foo getInstance() {
if (foo == null) foo = new Foo();
return foo;
}
}
foo.xml
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
LegacyA.java
package com.kohls;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class LegacyA {
public static void main(String args[]) {
ApplicationContext context = new ClassPathXmlApplicationContext("foo.xml");
FooFactory foofac = (FooFactory) context.getBean("foofactory");
Foo foo = foofac.getInstance();
System.out.println(foo);
}
}