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 ...
随机推荐
- Struts2的处理结果(四)——PreResultListener监听器
Struts2的处理结果(四) --PreResultListener监听器 1.PreResultListener是一个监听器接口,他在Action完成控制处理之后,系统转入实际物理视图资源之间被回 ...
- 【leetcode❤python】 205. Isomorphic Strings
#-*- coding: UTF-8 -*- #转换法class Solution(object): def isIsomorphic(self, s, t): "&qu ...
- 【leetcode❤python】141. Linked List Cycle
#-*- coding: UTF-8 -*- #Method:快慢指针法,建立虚表头,快指针走两步,慢指针走一步,若存在环,则快指针会追上慢指针# Definition for singly-link ...
- Cheatsheet: 2013 09.22 ~ 09.30
Other Python basics summary Another article about big O notation Mobile Getting Started with PhoneGa ...
- TreeList的使用
添加列 TreeListColumn column = treeList1.Columns.Add(); column.Caption = @"建筑列表"; column.Visi ...
- FRM-10001, FRM-10002, FRM-10003 Oracle Form Builder Error Solution
These errors occurred usually due to forms connection problem or some internal problem, the solution ...
- 巧遇"drwxr-xr-x."权限
drwxr-xr-x. 是SELinux的问题 REDHAT6之后安全提高所以设置的 关闭SELINUX就好了 因为新版本ls把多acl和selinux属性加进去了,与系统无关,新版本的ls代码使用1 ...
- mysql数据小姿势
CREATE TABLE `information` ( `NUMBER` bigint(20) NOT NULL AUTO_INCREMENT,//将number设为自增字段 `USER_NAM ...
- Building,Packaging,Deploying,and Administering Applications and Types
buliding types into a module: response files: the IL disassembler:ILDasm.exe add assemblies to a pro ...
- ABAP Enhancement:第一部分
声明:原创作品,转载时请注明文章来自SAP师太技术博客( 博/客/园www.cnblogs.com):www.cnblogs.com/jiangzhengjun,并以超链接形式标明文章原始出处,否则将 ...