3.5 配置ApplicationContext
2019-10-15 本文已影响0人
仙境源地
ApplicationContext
GenericXmlApplicationContext
GenericXmlApplicationContext ctx = new GenericXmlApplicationContext();
ctx.load("classpath:spring/app-context-xml.xml");
ctx.refresh();
MessageRenderer messageRenderer = ctx.getBean("renderer", MessageRenderer.class);
messageRenderer.render();
ctx.close();