Source Code : Bean Name Example
Java Is Open Source Programming Language You Can Download From Java and Java Libraries From http://www.oracle.com.
Click Here to download
We provide this code related to title for you to solve your developing problem easily. Libraries which is import in this program you can download from http://www.oracle.com.
Click Here or search from google with Libraries Name you get jar file related it
Bean Name Example
/*
Pro Spring
By Rob Harrop
Jan Machacek
ISBN: 1-59059-461-4
Publisher: Apress
*/
/////////////////////////////////////////////////////////////////////////////////////
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>
<bean id="fooBean" class="AutoBean"/>
<bean id="barBean" class="AutoBean"/>
</beans>
/////////////////////////////////////////////////////////////////////////////////////
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();
}
}
Thank with us