去官网下载jdk8
添加JAVA_HOME
右键运行
idea自动给你配置完成spring环境
记得勾选文件
编写helloworld类
配置文件
创建main类
public class Main {
public static void main(String[] args) {
// HelloWorld helloWorld = new HelloWorld();
// helloWorld.setName("Spring");
// helloWorld.sayHello();
ApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
HelloWorld helloWorld = (HelloWorld) context.getBean("helloWorld");
}
}
调用构造器输出



