idea创建 spring项目demo例子
1、创建一个如下结构的项目导入如图需要的jar包,这个junit.jar不要用4.12会报错:
2、HelloWorld.java
3、配置文件applicationContext.xml
<?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-2.5.xsd” >
<bean id ="helloWorld" class="com.aoji.cn.HelloWorld" ></bean>
</beans、、>
4、然后是测试用例:
5、运行结果: