首页>代码>spring基于xml文件配置实现初始化bean的实例>/spring-xml-based-configuration-example/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"});
CoffeeMachine coffeeMachine = context.getBean(CoffeeMachine.class);
coffeeMachine.makeCoffee("Java");
}
}
最近下载更多
littlejuck LV2
2023年6月11日

最近浏览
