首页>代码>spring通过c-namespace的方式实现xml配置bean构造函数实例>/spring-c-namespace-xml-configuration-shortcut/src/main/java/com/memorynotfound/spring/Run.java
package com.memorynotfound.spring; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; public class Run { public static void main(String... args){ ApplicationContext context = new ClassPathXmlApplicationContext(new String[]{"app-config.xml"}); // get bean with property CoffeeMachine coffeeMachine = context.getBean("coffeeMachine", CoffeeMachine.class); System.out.println(coffeeMachine); // get bean with c-namespace CoffeeMachine cCoffeeMachine = context.getBean("cCoffeeMachine", CoffeeMachine.class); System.out.println(cCoffeeMachine); } }