The following program shows how to launch an application context using the XML configuration. We use the main method to launch the application context using ClassPathXmlApplicationContext:
public class LaunchXmlContext { private static final User DUMMY_USER = new User("dummy"); public static Logger logger = Logger.getLogger(LaunchJavaContext.class); public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext( "BusinessApplicationContext.xml"); BusinessService service = context.getBean(BusinessService.class); logger.debug(service.calculateSum(DUMMY_USER)); } }
The following lines of code create the application context. We want ...