package
com.springexample;
import
java.util.Iterator;
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"
);
UserNameHolder userNameDetails = (UserNameHolder) context.getBean(
"userNameHolder"
);
System.out.println(
"Usernames"
);
for
(Iterator nameIterator = userNameDetails.getUserNames().iterator();nameIterator.hasNext();){
String name = nameIterator.next();
System.out.println(name);
}
}
}