Mega Code Archive
Factory Object Integration
File: context.xml
File: Main.java
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Main {
public static void main(String[] args) throws Exception {
ConfigurableListableBeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
"context.xml"));
java.net.Socket localhost = (java.net.Socket) beanFactory.getBean("localhost");
java.net.Socket apressDotCom = (java.net.Socket) beanFactory.getBean("rntsoft.com");
System.out.println(localhost.isConnected());
System.out.println(apressDotCom.isConnected());
}
}