package
com.springexample;
import
org.springframework.context.ApplicationContext;
import
org.springframework.context.support.ClassPathXmlApplicationContext;
public
class
RunMyProgram {
public
static
void
main(String[] args) {
ApplicationContext context =
new
ClassPathXmlApplicationContext(
"beans.xml"
);
if
(context.containsBean(
"johnPeterEnglandCollege"
)){
System.out.println(
"Bean exist: johnPeterEnglandCollege"
);
}
else
{
System.out.println(
"Bean not exist: johnPeterEnglandCollege"
);
}
if
(context.containsBean(
"josephCollege"
)){
System.out.println(
"Bean exist: JosephCollege"
);
}
else
{
System.out.println(
"Bean not exist: JosephCollege"
);
}
if
(context.containsBean(
"smartersCollege"
)){
System.out.println(
"Bean exist: SmartersCollege"
);
}
else
{
System.out.println(
"Bean not exist: SmartersCollege"
);
}
}
}