最近项目中准备集成Spring Data Redis,

<dependencies>
    <dependency>
        <groupId>org.springframework.data</groupId>
        <artifactId>spring-data-redis</artifactId>
        <version>1.7.1.RELEASE</version>
    </dependency></dependencies>

其版本稳定版已经到了1.7.1.RELEASE了,

其需要JDK level 6.0 and above, and Spring  3.2.8 and above.

由于之前项目Spirng版本为3.1.1,于是打算升级版本,

上官网看了下,Spring的版本都到4.3.0 RC2了,最新稳定的版本为4.2.6.RELEASE

<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-context</artifactId>
        <version>4.2.6.RELEASE</version>
    </dependency></dependencies>

出于好奇,就想看看Spring4做了哪些改进,毕竟版本号是大改动。

http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/

官方的文档写的非常的详细,这里大致的说下吧:

Spring4.x新特性_新特性上图来自Spring官方的文档,可以看到改进的还是挺多的。

移除相关deprecated packages 和method,增加对Java8的支持、Groovy式Bean定义DSL、对核心容器进行改进、对Web框架的改进、Websocket的实现、测试的改进。

同时还支持泛型依赖注入。

Spring4.x新特性_Spring_02

图2 Spring4 Modules

Spring4.x新特性_新特性_03

    图3  Spring3 Modules

上面的两幅图,大家可以仔细对比一下,图2是Spring4的modules,图3是spring3的modules。

更详细的介绍参见官网:#spring-whats-new


http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle/#spring-whats-new


这里顺带提一下ORM

Spring4.x新特性_新特性_04

虽然4.2.6里面依然提供了hibernate3的支持,但是官网是这么说的:

Hibernate 3.6.10

The org.springframework.orm.hibernate3 package will be phasing out as of Spring Framework 4.2. We keep supporting it for the time being; however, we strongly recommend an upgrade to Hibernate 4.2/4.3 or 5.0.

所以还是升级hibernate到4.2/4.3 or 5.0,hibernate最新的稳定的版本到了5.1.0.Final。


本博客后续会推出Spring4.2.6+Hibernate5.1.0+Shiro1.2.4的相关升级、集成博文。敬请期待。