chapter01 Spring简介
一、Spring是什么?
在了解Spring之前,我们来了解在Java EE框架下企业级开发采用EJB框架的一些不足:
(1) EJB太笨重,而且Entity EJB不能脱离容器
(2) 企业级服务使用困难
(3) 开发的复杂度太高
(4) 侵入式方案,EJB要使用特定的接口
因此,Spring应运而生。
Spring是一个开源的用于简化采用Java语言开发企业级程序的一个分层的框架。
关于程序的分层结构:
1、Presentation layer(表示层)
(1) 表示逻辑(生成界面代码)
(2) 接收请求
(3) 处理业务层抛出的异常
(4) 负责规则验证(数据格式,数据非空等)
(5) 流程控制
2、Service layer(服务层/业务层)
(1) 封装业务逻辑处理,并且对外暴露接口
(2) 负责事务,安全等服务
3、Persistence layer(持久层)
(1) 封装数据访问的逻辑,暴露接口
(2) 提供方便的数据访问的方案(查询语言,API,映射机制等)
Domain layer(域层)
(1) 业务对象以及业务关系的表示
(2) 处理简单的业务逻辑
(3) 域层的对象可以穿越表示层,业务层,持久层
二、Spring的作用
为什么要使用Spring?
(1) 简化企业级开发
① 封装了大部分的企业级服务,提供了更好的访问这些服务的方式
② 提供了IOC,AOP功能的容器,方便编程
(2) 遵循Spring框架的应用程序,一定是设计良好的,针对接口编程,这样就简化了企业级程序的设计。Spring是非侵入式的轻量级的框架(侵入的意思是:应用需要依赖于特定的API)
(3) Spring的组成
① Spring Core:核心容器,BeanFactory提供了组件生命周期的管理,组件的创建,装配,销毁等功能
SpringContext:ApplicationContext,扩展核心容器,提供事件处理、国际化等功能。它提供了一些企业级服务的功能,提供了JNDI,EJB,RMI的支持。(上下文就是一个对象,类似于集合,他会记录其他对象的状态)
② Spring AOP:提供切面支持
③ Spring DAO:提供事务支持,JDBC,DAO支持
④ Spring ORM:对流行的O/R Mapping封装或支持
⑤ Spring Web:提供Web应用上下文,对Web开发提供功能上的支持,如请求,表单,异常等。
⑥ Spring Web MVC:全功能MVC框架,作用等同于Struts。
分享到:
相关推荐
chapter01 Spring简介 1 chapter02 Spring的IoC 2 chapter03 Spring的AOP 5 chapter04 Spring对持久层的支持 11 chapter05 Spring对事务的支持 14 chapter06 SSH整合 15
eclipse_struts_hibernate_spring集成开发宝典 chapter01.rar
Chapter 5: Spring with Spring Boot Chapter 6: Testing with Spring Boot Chapter 7: Data Access with Spring Boot Chapter 8: Web Development with Spring Boot Chapter 9: Security with Spring Boot Chapter ...
Spring Boot in Action-chapter 2 sample
Title: Learning Spring Application Development Author: Ravi Kant Soni Length: 492 pages Edition: 1 Language: English Publisher: Packt Publishing - ...Chapter 8: Integrating Javamail And Jms With Spring
Each chapter has its own sources and each chapter can contain multiple source snippets TOC --- 1. Spring Development Tools 2. Spring Core Tasks 3. Spring Annotation Driven Core Tasks 4. Spring @MVC...
开发基于Struts Spring Hibernate Ajax的网上信息发布平台(Struts Hibernate Spring Ajax)--Chapter1
SSH 框架 struts-2.3.34 spring4.3.12 hibernate5.0.12 Tomcat7 jDK7 IDEA
Spring boot干货系列:(一)优雅的入门篇:chapter1 Spring Boot干货系列:(二)配置文件解析:chapter2 Spring Boot干货系列:(三)启动原理解析 Spring Boot干货系列:(四)开发Web应用之Thymeleaf篇:chapter...
spring实战chapter5的IDEA工程。 自己创建的IDEA工程,使用IDEA打开之后可以直接编译启动。
Getting started with Spring Framework is a hands-on guide to begin developing applications using Spring Framework. This book is meant for Java ...Chapter 14 – Securing applications using Spring Security
Chapter 1: Spring Boot—Introduction Chapter 2: Spring Boot—Basics Chapter 3: Spring MVC Chapter 4: Spring MVC - Async Chapter 5: Spring WebFlux Chapter 6: Spring Security Chapter 7: Data Access ...
Table of Contents Introduction Chapter 1: The Spring Framework Chapter 2: Model 2 and the MVC Pattern Chapter 3: Introduction to Spring MVC Chapter 4: Annotation-Based Controllers Chapter 5: Data ...
- chapter1:[基本项目构建(可作为工程脚手架),引入web模块,完成一个简单的RESTful API](http://blog.didispace.com/spring-boot-learning-1/) - [使用Intellij中的Spring Initializr来快速构建Spring Boot/...
spring dm in action sample chapter 6
Spring REST is a practical guide for designing and developing RESTful APIs using the Spring Framework. This book walks you through the process of designing and building a REST application while taking...
chapter10-spring-web(spring和javaweb完成学生注册功能)(csdn)————程序.pd
Chapter 2, Spring for Microservices, will introduce you Spring Boot framework. You will learn how to effictively use it to create microservice application. We will cover such topics like creating REST...
《精通Spring 2.x-企业应用开发详解》chapter17