/*
Pro Spring
By Rob Harrop
Jan Machacek
ISBN: 1-59059-461-4
Publisher: Apress
*/
/////////////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////////////
public class AutoBean {
public void foo() {
System.out.println("foo()");
}
}
/////////////////////////////////////////////////////////////////////////////////////
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;
public class BeanNameExample {
public static void main(String[] args) {
ApplicationContext ctx = new FileSystemXmlApplicationContext(
"build/bnapc.xml");
AutoBean fooBean = (AutoBean)ctx.getBean("fooBean");
AutoBean barBean = (AutoBean)ctx.getBean("barBean");
fooBean.foo();
barBean.foo();
}
}
BeanNameExample.zip( 1,478 k)