第一步:加入jar包

第二步:创建配置文件

-申明javabean 配置

<?xml version="1.0" encoding="UTF-8"?>

<beans  xmlns="http://www.springframework.org/schema/beans"  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:p="http://www.springframework.org/schema/p"  xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

<bean id="hw" class="com.amaker.test.HelloWorld">

<property name="name" value="amaker"/>

</bean>

</beans>

第三步:获取bean工厂

Resource r = new ClassPathResource("applicationContext.xml");

BeanFactory factory = new XmlBeanFactory(r);

第四步:获取对象 HelloWorld h =(HelloWorld) factory.getBean("hw");

创建Spring工程的基本步骤的更多相关文章

  1. 如何使用Maven创建web工程(详细步骤)

    使用eclipse插件创建一个web project 首先创建一个Maven的Project例如以下图 我们勾选上Create a simple project (不使用骨架) 这里的Packing ...

  2. idea创建springboot工程,总出现响应超时问题,或者无法连接http://start.spring.io导致创建失败

    问题描述如下: idea创建springboot工程,总出现响应超时问题,或者无法连接http://start.spring.io导致创建失败 从我出现此类问题几次的解决方案 依照解决效率分为一下三种 ...

  3. Ubuntu下使用VS Code创建Spring Boot工程

    目的 我们将在Ubuntu桌面系统下,使用VS Code(Visual Studio Code)编辑器从零开始创建一个Spring Boot工程,并实现一个简单的RESTful风格接口.使用这套流程的 ...

  4. 使用eclipse创建spring mvc web工程并部署

    创建maven工程

  5. maven创建web工程Spring配置文件找不到问题解决方案

    使用maven创建web工程,将Spring配置文件applicationContext.xml放在src/resource下,用eclipse编译时提示class path resource [ap ...

  6. spring 学习(一):使用 intellijIDEA 创建 maven 工程进行 Spring ioc 测试

    spring学习(一):使用 intellijIDEA 创建 maven 工程进行 Spring ioc 测试 ioc 概念 控制反转(Inversion of Control,缩写为IOC),是面向 ...

  7. maven创建web工程Spring配置文件找不到

    使用maven创建web工程,将Spring配置文件applicationContext.xml放在src/resource下,用eclipse编译时提示class path resource [ap ...

  8. 1.创建spring cloud父工程和子模块

    创建父工程 idea创建父工程 idea创建一个工程.父工程管理公共资源 添加子模块 选择添加到父工程里面spring_cloud_parent 相应的子模块添加到父工程的pom.xml文件里

  9. Spring MVC 编程流程步骤

    Spring MVC 编程流程步骤 1. 建立Maven工程 2. 添加Spring MVC依赖 <dependencies> <dependency> <groupId ...

随机推荐

  1. poj 2105 IP Address

    IP Address Time Limit: 1000MS   Memory Limit: 30000K Total Submissions: 18951   Accepted: 10939 Desc ...

  2. zato集群部署

    注: SQL ODB和Cluster’s config需要首先依次创建,其他三个次序随意 对不熟悉的命令,使用server create *** -h 查看帮助文档 修改完后配置文件,要重启(zato ...

  3. vue打包后运行在本地/非服务器端环境的访问路径

    vue打包前的配置: 项目目录下--> config文件夹---> index.js: build:  { assetsPublickPath:  './',   // 设置成相对路径   ...

  4. C# 连接Oracle,进行查询,插入操作

    注:OracleConnection和OracleCommand已被标注为[弃用的],可以使用System.Data.OleDb.OleDbConnection代替OracleCOnnection,使 ...

  5. 2017年11月27日 C#MDI窗体创建&记事本打印&记事本查找、自动换行

    MDI窗体第一个父窗体 把属性里的IsMdiContainer设置为true就可以了 父窗体连接子窗体 //创建一个新的类,用来连接别的窗体,并且别的窗体为唯一窗体 List<Form> ...

  6. @RequestBody与serialize()、serializeArray()、拼接Json 妙用总结

    @requestBody注解常用来处理content-type不是默认的application/x-www-form-urlcoded编码的内容, 比如说:application/json或者是app ...

  7. Javascript之for循环该注意的问题

    很多时候我们都用到for循环,而用到for循环部门往往对一个数组进行循环,其中我们很多时候都是这样写的: // 次佳的循环 for (var i = 0; i < myarray.length; ...

  8. jxls实现基于excel模板的报表

    此文章是基于 搭建Jquery+SpringMVC+Spring+Hibernate+MySQL平台 一. jar包介绍 1. commons-collections-3.2.jar 2. commo ...

  9. json_decode($json, true) true什么意思

    <?php $json = '{"a":1,"b":2,"c":3,"d":4,"e":5}' ...

  10. enter键触发事件

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...