`
61party
  • 浏览: 1101015 次
  • 性别: Icon_minigender_2
  • 来自: 北京
文章分类
社区版块
存档分类
最新评论

Spring 3.0.0 is Now Available (2009-12-16)

 
阅读更多

Spring 3.0.0 is Now Available

It's here just in time for the holidays! Arjen Poutsma has just announced that Spring 3.0.0 is now final and Juergen Hoeller has blogged about the features in the release.

Download | Documentation | Javadoc API | Change Log | JIRA

Congratulations to Juergen, Arjen and all the other SpringSource engineers that worked so hard on the release. Also a huge thank you to all of the dedicated community members that have given feedback and identified issues along the way. Please keep up the good work so that we can continue to make all the Spring projects better and better.

Spring Framework 3.0 is the next generation of Spring: fully Java 5 based,
EL enabled, REST enabled, and with support for JSR-330 (Dependency Injection)
and JSR-303 (Bean Validation).

What's New in Spring 3.0

2.New Features and Enhancements in Spring 3.0

If you have been using the Spring Framework for some time, you will be aware that Spring has undergone two major revisions: Spring 2.0, released in October 2006, and Spring 2.5, released in November 2007. It is now time for a third overhaul resulting in Spring 3.0.

2.1Java 5

The entire framework code has been revised to take advantage of Java 5 features like generics, varargs and other language improvements. We have done our best to still keep the code backwards compatible. We now have consistent use of generic Collections and Maps, consistent use of generic FactoryBeans, and also consistent resolution of bridge methods in the Spring AOP API. Generic ApplicationListeners automatically receive specific event types only. All callback interfaces such as TransactionCallback and HibernateCallback declare a generic result value now. Overall, the Spring core codebase is now freshly revised and optimized for Java 5.

Spring's TaskExecutor abstraction has been updated for close integration with Java 5's java.util.concurrent facilities. We provide first-class support for Callables and Futures now, as well as ExecutorService adapters, ThreadFactory integration, etc. This has been aligned with JSR-236 (Concurrency Utilities for Java EE 6) as far as possible. Furthermore, we provide support for asynchronous method invocations through the use of the new @Async annotation (or EJB 3.1's @Asynchronous annotation).

2.2Improved documentation

The Spring reference documentation has also substantially been updated to reflect all of the changes and new features for Spring 3.0. While every effort has been made to ensure that there are no errors in this documentation, some errors may nevertheless have crept in. If you do spot any typos or even more serious errors, and you can spare a few cycles during lunch, please do bring the error to the attention of the Spring team by raising an issue.

2.3New getting started tutorial

There is now a new getting started tutorial for developing a basic Spring 3.0 MVC web application. This tutorial is a separate document that can be found at the Spring Documentation page.

2.4New module organization and build system

The framework modules have been revised and are now managed separately with one source-tree per module jar:

  • org.springframework.aop

  • org.springframework.beans

  • org.springframework.context

  • org.springframework.context.support

  • org.springframework.expression

  • org.springframework.instrument

  • org.springframework.jdbc

  • org.springframework.jms

  • org.springframework.orm

  • org.springframework.oxm

  • org.springframework.test

  • org.springframework.transaction

  • org.springframework.web

  • org.springframework.web.portlet

  • org.springframework.web.servlet

  • org.springframework.web.struts

We are now using a new Spring build system as known from Spring Web Flow 2.0. This gives us:

  • Ivy-based "Spring Build" system

  • consistent deployment procedure

  • consistent dependency management

  • consistent generation of OSGi manifests

2.5Overview of new features

This is a list of new features for Spring 3.0. We will cover these features in more detail later in this section.

  • Spring Expression Language

  • IoC enhancements/Java based bean metadata

  • General-purpose type conversion system and field formatting system

  • Object to XML mapping functionality (OXM) moved from Spring Web Services project

  • Comprehensive REST support

  • @MVC additions

  • Declarative model validation

  • Early support for Java EE 6

  • Embedded database support

2.5.1Core APIs updated for Java 5

BeanFactory interface returns typed bean instances as far as possible:

  • T getBean(Class<T> requiredType)

  • T getBean(String name, Class<T> requiredType)

  • Map<String, T> getBeansOfType(Class<T> type)

Spring's TaskExecutor interface now extends java.util.concurrent.Executor:

  • extended AsyncTaskExecutor supports standard Callables with Futures

New Java 5 based converter API and SPI:

  • stateless ConversionService and Converters

  • superseding standard JDK PropertyEditors

Typed ApplicationListener<E>

2.5.2Spring Expression Language

Spring introduces an expression language which is similar to Unified EL in its syntax but offers significantly more features. The expression language can be used when defining XML and Annotation based bean definitions and also serves as the foundation for expression language support across the Spring portfolio. Details of this new functionality can be found in the chapter Spring Expression Language (SpEL).

The Spring Expression Language was created to provide the Spring community a single, well supported expression language that can be used across all the products in the Spring portfolio. Its language features are driven by the requirements of the projects in the Spring portfolio, including tooling requirements for code completion support within the Eclipse based SpringSource Tool Suite.

The following is an example of how the Expression Language can be used to configure some properties of a database setup

<bean class="mycompany.RewardsTestDatabase">
    <property name="databaseName"
        value="#{systemProperties.databaseName}"/>
    <property name="keyGenerator"
        value="#{strategyBean.databaseKeyGenerator}"/>
</bean>

This functionality is also available if you prefer to configure your components using annotations:

@Repository 
public class RewardsTestDatabase {

    @Value("#{systemProperties.databaseName}")
    public void setDatabaseName(String dbName) { … }

    @Value("#{strategyBean.databaseKeyGenerator}")
    public void setKeyGenerator(KeyGenerator kg) { … }
}

2.5.3The Inversion of Control (IoC) container

2.5.3.1Java based bean metadata

Some core features from the JavaConfig project have been added to the Spring Framework now. This means that the following annotations are now directly supported:

  • @Configuration

  • @Bean

  • @DependsOn

  • @Primary

  • @Lazy

  • @Import

  • @ImportResource

  • @Value

Here is an example of a Java class providing basic configuration using the new JavaConfig features:

package org.example.config;

@Configuration
public class AppConfig {
    private @Value("#{jdbcProperties.url}") String jdbcUrl;
    private @Value("#{jdbcProperties.username}") String username;
    private @Value("#{jdbcProperties.password}") String password;

    @Bean
    public FooService fooService() {
        return new FooServiceImpl(fooRepository());
    }

    @Bean
    public FooRepository fooRepository() {
        return new HibernateFooRepository(sessionFactory());
    }

    @Bean
    public SessionFactory sessionFactory() {
        // wire up a session factory
        AnnotationSessionFactoryBean asFactoryBean = 
            new AnnotationSessionFactoryBean();
        asFactoryBean.setDataSource(dataSource());
        // additional config
        return asFactoryBean.getObject();
    }

    @Bean
    public DataSource dataSource() { 
        return new DriverManagerDataSource(jdbcUrl, username, password);
    }
}

To get this to work you need to add the following component scanning entry in your minimal application context XML file.

<context:component-scan base-package="org.example.config"/>
<util:properties id="jdbcProperties" location="classpath:org/example/config/jdbc.properties"/>
        

Or you can bootstrap a @Configuration class directly using AnnotationConfigApplicationContext:

public static void main(String[] args) {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    FooService fooService = ctx.getBean(FooService.class);
    fooService.doStuff();
}

See Section3.11.2, “Instantiating the Spring container using AnnotationConfigApplicationContext” for full information on AnnotationConfigApplicationContext.

2.5.3.2Defining bean metadata within components

@Bean annotated methods are also supported inside Spring components. They contribute a factory bean definition to the container. See Defining bean metadata within components for more information

2.5.4General purpose type conversion system and field formatting system

A general purpose type conversion system has been introduced. The system is currently used by SpEL for type conversion, and may also be used by a Spring Container and DataBinder when binding bean property values.

In addition, a formatter SPI has been introduced for formatting field values. This SPI provides a simpler and more robust alternative to JavaBean PropertyEditors for use in client environments such as Spring MVC.

2.5.5The Data Tier

Object to XML mapping functionality (OXM) from the Spring Web Services project has been moved to the core Spring Framework now. The functionality is found in the org.springframework.oxm package. More information on the use of the OXM module can be found in the Marshalling XML using O/X Mappers chapter.

2.5.6The Web Tier

The most exciting new feature for the Web Tier is the support for building RESTful web services and web applications. There are also some new annotations that can be used in any web application.

2.5.6.1Comprehensive REST support

Server-side support for building RESTful applications has been provided as an extension of the existing annotation driven MVC web framework. Client-side support is provided by the RestTemplate class in the spirit of other template classes such as JdbcTemplate and JmsTemplate. Both server and client side REST functionality make use of HttpConverters to facilitate the conversion between objects and their representation in HTTP requests and responses.

The MarshallingHttpMessageConverter uses the Object to XML mapping functionality mentioned earlier.

Refer to the sections on MVC and the RestTemplate for more information.

2.5.6.2@MVC additions

A mvc namespace has been introduced that greatly simplifies Spring MVC configuration.

Additional annotations such as @CookieValue and @RequestHeaders have been added. See Mapping cookie values with the @CookieValue annotation and Mapping request header attributes with the @RequestHeader annotation for more information.

2.5.7Declarative model validation

Several validation enhancements, including JSR 303 support that uses Hibernate Validator as the default provider.

2.5.8Early support for Java EE 6

We provide support for asynchronous method invocations through the use of the new @Async annotation (or EJB 3.1's @Asynchronous annotation).

JSR 303, JSF 2.0, JPA 2.0, etc

2.5.9Support for embedded databases

Convenient support for embedded Java database engines, including HSQL, H2, and Derby, is now provided.

分享到:
评论

相关推荐

    springfox-spring-webmvc-3.0.0-API文档-中文版.zip

    赠送原API文档:springfox-spring-webmvc-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webmvc-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webmvc-3.0.0.pom; 包含翻译后的API文档:...

    springfox-spring-webmvc-3.0.0-API文档-中英对照版.zip

    赠送原API文档:springfox-spring-webmvc-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webmvc-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webmvc-3.0.0.pom; 包含翻译后的API文档:...

    springfox-spring-webflux-3.0.0-API文档-中文版.zip

    赠送原API文档:springfox-spring-webflux-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webflux-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webflux-3.0.0.pom; 包含翻译后的API文档:...

    OpenCV-3.0.0-android-sdk-1.zip

    这个“OpenCV-3.0.0-android-sdk-1.zip”压缩包包含了OpenCV 3.0.0版本针对Android平台的SDK,为开发者提供了一系列在Android设备上实现计算机视觉功能的工具和资源。 首先,OpenCV的核心是其C++库,它包含了大量的...

    protobuf-3.0.0-beta-2-cpp

    安装protobuf各个版本的编译代码,从protobuf-2.4.1到protobuf-3.0.0-Release之间的20个版本,在Mac上protobuf-2.6.1、protobuf-3.0.0-alpha-1、protobuf-3.0.0-beta-2、protobuf-3.0.0测试全部成功!解决了从GitHub...

    openGauss Tools(Chameleon_3.0.0)chameleon-3.0.0-py3-none-any.whl

    openGauss Tools(Chameleon_3.0.0)chameleon-3.0.0-py3-none-any.whl

    spring3.0.0相关jar包

    spring3.0.0相关jar包 org.springframework.aop-3.0.0.RELEASE org.springframework.asm-3.0.0.RELEASE org.springframework.aspects-3.0.0.RELEASE org.springframework.beans-3.0.0.RELEASE org.springframework....

    spark-3.0.0-bin-without-hadoop.tgz

    "spark-3.0.0-bin-without-hadoop.tgz" 是Spark 3.0.0版本的二进制发行版,但不包含Hadoop依赖。这个版本特别适合那些已经拥有Hadoop环境或者打算在其他分布式存储系统上运行Spark的应用场景。 Spark的设计目标是...

    ksoap2-android-assembly-3.0.0-jar-with-dependencies.jar

    修改后的jar包,原始的包,打包签名的时候会出现错误,因为里边有可系统自带的类重复的,这个已经删除了。。如果你只是用来连接webservice的话就直接用可以了,代码混淆里也不需要多余的操作。 ...

    springfox-spring-webflux-3.0.0-API文档-中英对照版.zip

    赠送原API文档:springfox-spring-webflux-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-webflux-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-webflux-3.0.0.pom; 包含翻译后的API文档:...

    openGauss_3.0.0 极简版(openGauss-3.0.0-openEuler-64bit.tar.bz2)

    openGauss_3.0.0 极简版(openGauss-3.0.0-openEuler-64bit.tar.bz2)适用于openeuler_x86_64

    ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies.

    最新的 ksoap2-android-assembly-3.0.0-RC.4-jar-with-dependencies

    openGauss_3.0.0 企业版(openGauss-3.0.0-CentOS-64bit-all.tar.gz)

    2. `openGauss-3.0.0-CentOS-64bit-om.tar.gz`:OM(Operation Manager)是openGauss的运营管理工具,用于数据库的安装、升级、备份、恢复等操作。 3. `openGauss-3.0.0-CentOS-64bit-cm.tar.gz`:CM(Cluster ...

    spring-framework-3.0.0.RELEASE-with-docs

    《Spring Framework 3.0.0.RELEASE:深入解析与应用》 Spring Framework,作为Java领域最广泛应用的轻量级框架之一,自2003年发布以来,一直以其强大的功能和灵活的设计深受开发者喜爱。在3.0.0.RELEASE版本中,...

    spring-framework-3.0.0.M4-with-docs

    org.springframework.expression-3.0.0.M4.jar: spring表达式语言 org.springframework.test-3.0.0.M4.jar: spring提供的一个测试框架 org.springframework.jdbc-3.0.0.M4.jar: 对JDBC的简单封装 org.spring...

    springfox-spring-web-3.0.0-API文档-中文版.zip

    赠送原API文档:springfox-spring-web-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-web-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-web-3.0.0.pom; 包含翻译后的API文档:springfox-...

    redis-3.0.0.tar和redis-3.0.0.gem.rar

    在这个场景中,我们关注的是Redis的集群搭建,涉及到的文件是"redis-3.0.0.tar"和"redis-3.0.0.gem"。这两个文件分别对应Redis服务本身和通过Ruby来创建Redis集群的工具。 首先,`redis-3.0.0.tar`是一个源代码...

    openGauss_3.0.0 企业版(openGauss-3.0.0-openEuler-64bit-all.tar.gz)

    此版本的压缩包(openGauss-3.0.0-openEuler-64bit-all.tar.gz)包含了完整的软件栈,旨在提供企业级的稳定性和性能。以下是对其中主要组件和功能的详尽解析: 1. **openGauss-3.0.0-openEuler-64bit.tar.bz2**:这...

    springfox-spring-web-3.0.0-API文档-中英对照版.zip

    赠送原API文档:springfox-spring-web-3.0.0-javadoc.jar; 赠送源代码:springfox-spring-web-3.0.0-sources.jar; 赠送Maven依赖信息文件:springfox-spring-web-3.0.0.pom; 包含翻译后的API文档:springfox-...

    maven-antrun-plugin-3.0.0.jar

    maven-antrun-plugin-3.0.0.jar

Global site tag (gtag.js) - Google Analytics