一:准本工作(下载需要的jar包)

1.下载准备Spring-framework-4.2.0

  链接为:

  http://repo.springsource.org/libs-release-local/org/springframework/spring/

  截图:

  

2.具体的spring-framework4.2.0

  

3.下载log

  链接为:

  http://commons.apache.org/proper/commons-logging/download_logging.cgi

  截图:

  

二:建项目

1.新建普通的java项目

  

2.新建lib文件夹,并将jar包复制粘贴进去

  

3.将lib包进行buid path

  

  然后将需要的jar从firstSpring中导入

  

  然后reply和ok

  

4.这时的效果

  

5.新建包

  类包:

  

  XML包

  

6.新建类

  第一个接口

1 package main.java.com.sommer.learn;
2
3 public interface HelloWorld {
4 public String sayHi();
5 }

  实现类

1 package main.java.com.sommer.learn;
2
3 public class HelloWorldImpl implements HelloWorld{
4 @Override
5 public String sayHi() {
6 return "hahahahahha";
7 }
8
9 }

7.新建xml文件

1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans
3 xmlns="http://www.springframework.org/schema/beans"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://www.springframework.org/schema/beans
6 http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
7
8 <bean id="helloWorld" class="main.java.com.sommer.learn.HelloWorldImpl"></bean>
9 </beans>

8.新建主函数

 1 package main.java.com.sommer.learn;
2 import org.springframework.context.ApplicationContext;
3 import org.springframework.context.support.ClassPathXmlApplicationContext;
4
5 public class Main {
6 public static void main(String[] args) {
7 ApplicationContext apc = new ClassPathXmlApplicationContext("springXML/HelloWorld.xml");
8 HelloWorld hello = apc.getBean("helloWorld",HelloWorld.class);
9 System.out.println(hello.sayHi());
10 }
11 }

9.运行

  

自己写的源码:http://pan.baidu.com/s/1kV67rYf

Spring学习(二)-----eclipse新建spring项目的更多相关文章

  1. Spring学习(三)——Spring中的依赖注入的方式

    [前面的话] Spring对我太重要了,做个关于web相关的项目都要使用Spring,每次去看Spring相关的知识,总是感觉一知半解,没有很好的系统去学习一下,现在抽点时间学习一下Spring.不知 ...

  2. Spring学习之——手写Spring源码V2.0(实现IOC、D、MVC、AOP)

    前言 在上一篇<Spring学习之——手写Spring源码(V1.0)>中,我实现了一个Mini版本的Spring框架,在这几天,博主又看了不少关于Spring源码解析的视频,受益匪浅,也 ...

  3. eclipse新建maven项目:'Building' has encountered a problem. Errors occurred during the build.

    二.eclipse 新建maven 项目报错(因为没有配置maven环境) 1.问题: ① 出现的问题1: Could not calculate build plan:Plugin org.apac ...

  4. spring 学习(四): spring 的 jdbcTemplate 操作

    spring 学习(四): spring 的 jdbcTemplate 操作 spring 针对 javaee 的每一层,都提供了相应的解决技术,jdbcTemplate 的主要操作在 dao 层. ...

  5. eclipse新建maven项目(2)

    本篇博文是继续之前的博文eclipse新建maven项目(1),那篇博文不在随笔在文章中.首先按照之前那篇博文进行创建maven项目操作,一系列操作下来之后发现刷新项目后会报错: 别急哈,可以解决. ...

  6. eclipse新建web项目,发布 run as 方式和 new server然后添加项目方式。 后者无法自动编译java 成class文件到classes包下。

    eclipse新建web项目,发布 run as 方式和 new server然后添加项目方式. 后者无法自动编译java 成class文件到classes包下. 建议使用run as  -  run ...

  7. day 82 Vue学习二之vue结合项目简单使用、this指向问题

    Vue学习二之vue结合项目简单使用.this指向问题   本节目录 一 阶段性项目流程梳理 二 vue切换图片 三 vue中使用ajax 四 vue实现音乐播放器 五 vue的计算属性和监听器 六 ...

  8. eclipse新建maven项目报错Could not resolve arachetype org.apache.maven.archetypes:mmaven-archetype-quickstart:1.1 from any of the configured repositories

    使用eclipse新建maven项目,按下图所示选择后,报错 报错截图 报错详细信息 Could not resolve archetype org.apache.maven.archetypes:m ...

  9. day 81 Vue学习二之vue结合项目简单使用、this指向问题

    Vue学习二之vue结合项目简单使用.this指向问题   本节目录 一 阶段性项目流程梳理 二 vue切换图片 三 vue中使用ajax 四 vue实现音乐播放器 五 vue的计算属性和监听器 六 ...

随机推荐

  1. 24、springboot与缓存(2)

    具体看上文!!! @Service public class EmpService { @Autowired EmployeeMapper employeeMapper; @Cacheable(cac ...

  2. Golang测试包

    Golang测试包 golang自带了测试包(testing),直接可以进行单元测试.性能分析.输出结果验证等.简单看着官方文档试了试,总结一下: 目录结构和命令 使用golang的测试包,需要遵循简 ...

  3. linux下搭建LAMP

    PHP命令找不到:  export PATH=$PATH:/usr/local/php/bin https://www.centos.bz/forum/thread-69-1-1.html 步骤: w ...

  4. SDN测量论文粗读(一)9.19

    UMON: Flexible and Fine Grained Traffic Monitoring in Open vSwitch 论文来源:CoNext 发表时间:2015 解决问题及所做贡献:现 ...

  5. 内核调试工具——strace

    简介 strace常用来跟踪进程执行时的系统调用和所接收的信号. 在Linux世界,进程不能直接访问硬件设备,当进程需要访问硬件设备(比如读取磁盘文件,接收网络数据等等)时,必须由用户态模式切换至内核 ...

  6. FCC Truncate a string 解决方法

    三行搞定 function truncate(str, num) { ab = str.length >num?num>3?str.slice(0,num-3)+ "...&qu ...

  7. iOS dyld: Library not loaded 报错解决

    Xcode 用的是10.1 版本打的苹果包在 ios系统10.0 以上可以正常运行 但是系统9.3的手机安装后直接运行就崩溃 后来插上电脑联调 报错 dyld: Library not loaded: ...

  8. JS の 套路 II ~~

    今天的需求是 给表单赋值 还有修改并保存.以下的方法应该是个本方法,但好上手!! 给表单值 <form> <table> <tbodu> 这里假装有一堆表单的一对t ...

  9. iOS笔记,开发经验总结【持续更新】

    1. 设置navigationBar 背景颜色有色差, 原因:如果单纯的设置背景颜色也是有高斯模糊处理的效果,对纯色高斯模糊处理过后相当于纯色的70%(猜测)透明化处理,但是反正就是有色差 解决方法一 ...

  10. Maven 逆向工程

    pom.xml <build> <plugins> <plugin> <groupId>org.mybatis.generator</groupI ...