import java.util.Properties;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;
public class Main {
public static void main(String[] args) throws Exception {
BeanFactory beanFactory =
new XmlBeanFactory(
new ClassPathResource(
"context.xml"
)
);
PrimeIterator primeNumber1 = (PrimeIterator)beanFactory.getBean("primeIterator");
PrimeIterator primeNumber2 = (PrimeIterator)beanFactory.getBean("primeIterator");
System.out.println(primeNumber1.getNextPrime());
System.out.println(primeNumber2.getNextPrime());
}
}
class PrimeIterator {
int start = -1;
public int getNextPrime() {
return start;
}
public int getStart() {
return start;
}
public void setStart(int start) {
this.start = start;
}
}
|