使用Spring创建HelloWorld项目
创建一个HelloWorld项目 1.导入Spring的Java包: 2.配置applicationContext.xml文件 注:可以下在spring tool插件使开发更轻松! 3.编写applicationContext.xml文件,并添加相应的标签。这个applicationContext.xml即为IOC容器 < ? xml version = "1.0" encoding = "UTF-8" ? > < beans xmlns = "http://www.springframework.org/schema/beans" xmlns : xsi = "http://www.w3.org/2001/XMLSchema-instance" xsi : schemaLocation = "http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd" > < bean id = "hello" class = "com.ming.bean.HelloWorld" > < ! -- 使用构造器的方式注入,根据参数列表的的不同,IOC容器自动调用不同的构造器 -- > < constructor - arg value = "ming