// Load spring config
ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(new String[] { "application-context.xml" });
BeanFactory factory = (BeanFactory) appContext;
// Start Demo
RandomTemperatureEventGenerator generator = (RandomTemperatureEventGenerator) factory.getBean("eventGenerator");
generator.startSendingTemperatureReadings(noOfTemperatureEvents);
}