Launching an application context with the XML configuration

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 ...

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.