spring来了-02-HelloWorld
spring的各个版本说明:
在3.0以下的版本,源码有spring中相关的所有包[spring功能+依赖包],如:2.5版本
在3.0以上的版本,源码中只有spring的核心功能包[没有依赖包],如果要用依赖包,需要单独下载!
- 在spring-framework-3.2.5.RELEASE中,
- 核心的5个jar包,必需的
- commons-logging-1.1.3.jar 日志(依赖包)
- spring-beans-3.2.5.RELEASE.jar bean节点
- spring-context-3.2.5.RELEASE.jar spring上下文节点
- spring-core-3.2.5.RELEASE.jar spring核心功能
- spring-expression-3.2.5.RELEASE.jar spring表达式相关
- 核心的5个jar包,必需的
- 核心配置文件:applicationContext.xml,也可以为bean.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"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd"> <bean id="user" class="cn.fuyi.a_helloworld.User"></bean>
</beans> - 测试
public class App { @Test
public void testIOC() {
Resource resource = new ClassPathResource("cn/fuyi/a_helloworld/ApplicationContext.xml");
BeanFactory factory = new XmlBeanFactory(resource); User user = (User) factory.getBean("user");
System.out.println(user);
} @Test
public void testAc() throws Exception {
ApplicationContext ac = new ClassPathXmlApplicationContext("cn/fuyi/a_helloworld/ApplicationContext.xml"); User user = (User)ac.getBean("user");
System.out.println(user);
} }
spring来了-02-HelloWorld的更多相关文章
- 基于XML配置的Spring MVC 简单的HelloWorld实例应用
1.1 问题 使用Spring Web MVC构建helloworld Web应用案例. 1.2 方案 解决本案例的方案如下: 1. 创建Web工程,导入Spring Web MVC相关开发包. Sp ...
- 学习spring2--跟我一起学Spring 3(3)–使用Spring开发第一个HelloWorld应用
http://www.importnew.com/13246.html 首页 所有文章 资讯 Web 架构 基础技术 书籍 教程 我要投稿 更多频道 » - 导航条 - 首页 所有文章 资讯 ...
- Spring:笔记整理(1)——HelloWorld
Spring:笔记整理(1)——HelloWorld 导入JAR包: 核心Jar包 Jar包解释 Spring-core 这个jar 文件包含Spring 框架基本的核心工具类.Spring 其它组件 ...
- 黑马_13 Spring Boot:01.spring boot 介绍&&02.spring boot 入门
13 Spring Boot: 01.spring boot 介绍&&02.spring boot 入门 04.spring boot 配置文件 SpringBoot基础 1.1 原有 ...
- 4-3 Spring MVC框架-02
Spring MVC框架-02 Ⅰ.RESTful基础 是一种设计风格和开发方式 1.get和post请求区别: get post 获取请求 上传请求 请求参数在地址栏URL 请求参数在请求体里面 U ...
- 基于注解配置的Spring MVC 简单的HelloWorld实例应用
2.1 问题 使用注解的方式重构helloworld应用案例. 2.2 方案 1. @RequestMapping注解应用 @RequestMapping可以用在类定义和方法定义上,它标明这个类或方法 ...
- 使用Spring开发第一个HelloWorld应用
http://www.importnew.com/13246.html 让我们用Spring来写第一个应用程序吧. 完成这一章要求: 熟悉Java语言 设置好Spring的环境 熟悉简单的Eclips ...
- spring MVC 初探 (HelloWorld)
1.使用spring MVC 需要导入相关jar包 2.web.xml 启用spring MVC <servlet> <servlet-name>spring3mvc</ ...
- Spring学习笔记——02 Bean的命名及实例化
一.Bean的命名 前一篇讲到IoC是一个管理Bean的容器,Bean多数情况下都是通过XML文件进行配置的,其中Bean的命名有以下几种方式,现在梳理一下. 1. 不指定id,只配置类名 <b ...
- 五.Spring与RabbitMQ集成--HelloWorld
spring对RabbitMQ做了很好的集成,我们称之为spring AMQP,其官方文档写得十分详尽,文档地址:https://docs.spring.io/spring-amqp/referenc ...
随机推荐
- 初试 uTenux
申请的的开发套件到目前还没到手,看到网友们都开始动手干了,我也是按捺不住了,所以就先在悠龙公司的主页下载了uTenux_V1.5.00r160.zip,打算看看,先了解一下. 下面是文件目录表: └─ ...
- 【leetcode❤python】235. Lowest Common Ancestor of a Binary Search Tree
#-*- coding: UTF-8 -*- # Definition for a binary tree node.# class TreeNode(object):# def __init ...
- 关于跨域的ajax
$.getJSON("http://query.yahooapis.com/v1/public/yql?callback=?", { q: "select * from ...
- Horizontal Toolbar With Navigational Buttons Form Sample For Oracle Forms 10g/11g
Sharing an Oracle Form Htoolbar.fmb for Oracle Forms 10g/11g containing Horizontal Toolbar canvas an ...
- CUBRID学习笔记 40 使用net修改数据
修改 connection.Open(); string queryString = "UPDATE nation set capital = 'X' where `code` = ...
- js文件的装载和执行
1.浏览器对script引用的js文件分两步,下载,下载完毕后马上执行:这两步都会阻塞浏览器继续解析. 2.加入defer属性,<script defer type="text/jav ...
- Android中序列化对象到XMl 和 XML反序列化为对象
package com.example.xmloperation; import java.io.File; import java.io.FileOutputStream; import java. ...
- 三大域对象的使用总结request域 + session域 +
request域: servlet 产生数据显示完后,就没用了. session域:数据除了显示之外,等一会还要用. servletContext域: 数据除了显示之外不仅还要用还要给其他人用.
- CSS的基本操作
<html> <!-- . 给整个页面填一个一个背景 . 给em添加一个样式样倾斜效果消失 . 改变第一层UL的样式为蓝色,16px . 改变第二层的UL的样式为红色 14px . ...
- 笔记本_hp
1.技术支持 http://support.hp.com/cn-zh 2.搜到的信息:“http://forum.51nb.com/thread-1080424-1-1.html” Product N ...