阅读更多

23顶
1踩

企业架构

原创新闻 Spring 3.0 M3 发布

2009-05-08 11:28 by 正式编辑 hantsy 评论(7) 有10175人浏览

Spring 团队宣布正式提供 spring 3.0 M3,这个版本中包含了一些新的特性。

1.参考文档的更新,虽然还在进行之中,但已经包含了最的m3 的特性。

2.基于注解的工厂方法, M3包含了一些基于JavaConfig 项目的成果。

3.meta-annotaions 的扩展支持。@Scope  @Transactional @Service  @Controller 可用于自定义的annotations 上。

4. 提供统一的TaskScheduler 抽象层。

5. 提供新的类型转换 SPI 和converter API,作为现有方式的一种替代方案,在RC1 还计划提供基于注解的验证。

 

 

 

原文

We are pleased to announce that the third Spring 3.0 milestone is available now (download page)! This release comes with many new features and refinements, including…

Reference documentation: M3 is the first Spring 3.0 milestone that comes with reference documentation, in both HTML and PDF format. Even if the documentation is still a work in progress, it does cover many 3.0 feature areas at this point already. We hope that you'll find this early cut of the documentation useful for learning more about the 3.0 milestone features.

Annotated factory methods: Spring 3.0 M3 includes the core functionality of the Spring JavaConfig project, namely configuration classes with annotated factory methods that define managed beans.

@Bean @Primary @Lazy
public RewardsService rewardsService() {
return new RewardsServiceImpl(…);
}

Such factory methods are supported on any annotated component class (e.g. plain @Component classes), building and exposing bean objects based on the component's state. They will simply be treated as further bean definitions derived from that component class, in addition to the bean definition for the containing component. The default name for such a bean definition is the name of its factory method (in the example above: "rewardsService"). Those bean instances will be obtained through factory method calls whenever the container needs to obtain a fresh instance. This is semantically close to XML bean definitions with a factory-bean/factory-method reference.

Beyond simple factory methods, we support the JavaConfig mode of operation as well: If factory methods are defined on a class marked with the @Configuration annotation, then special behavior applies… Factory methods on such explicit configuration components are allowed to call other factory methods on the same component, with those internal factory method calls being rerouted through the container! This allows for building graphs of container-managed bean instances, with the builder code simply consisting of chained Java factory method calls. Like the original JavaConfig project, we are generating CGLIB subclasses of such configuration classes in order to provide those extended semantics.

Note that annotated factory methods can be mixed and matched with XML bean definitions in a seamless fashion. They can also be mixed and matched with regular annotated component classes, reusing many common annotations such as @Scope, @Lazy, @Primary, and @Qualifier. Components containing annotated factory methods may be defined in XML or detected through component scanning in the classpath. Basically, the same rules as for any regular Spring beans apply; this is now a natural extension of Spring 2.5's support for annotated components.

Extended support for meta-annotations: Spring's @Scope and @Transactional annotations, as well as specialized stereotypes such as @Service and @Controller, can be applied as meta-annotations on custom annotations now. For example:

@Service
@Scope("request")
@Transactional(rollbackFor=Exception.class)

@Retention(RetentionPolicy.RUNTIME)
public @interface MyService {
}

@MyService
public class RewardsService {

}

This is a powerful way of defining custom stereotype annotations with extended default semantics as shown above. Alternatively, you may build simple custom scope annotations: e.g. a custom @RequestScoped annotation marked with @Scope("request"), or custom transaction annotations: e.g. @MyTx marked with @Transactional(rollbackFor=Exception.class). In other words, this allows for creating convenient shortcut annotations for your preferred configuration variants!

TaskScheduler abstraction: Spring provides a full-fledged scheduling facade API now, including adapters for standard ScheduledExecutorServices and also CommonJ TimerManagers. This comes with a Trigger abstraction and a CronTrigger implementation for simple scheduling based on cron expressions. In 3.0 RC1, we'll be adding a scheduling namespace for convenient XML-based configuration on top of this.

New type conversion SPI and converter API: Inspired by the capabilities of Spring Web Flow's binding subsystem, Spring supports stateless Java 5 based type converters now. This has been integrated with Spring 3.0's expression parser already and will be fully supported as an alternative to standard JDK PropertyEditors for all Spring binding purposes in 3.0 RC1. Likewise, Spring Web Flow 3.0 will be using this new unified conversion subsystem as well.

We are now moving on to Spring 3.0 RC1 which is scheduled for release in June. A major new feature planned for RC1 is support for annotation-based validation: specifically, the integration of JSR-303 Bean Validation providers. We are also researching refinements to the start/stop lifecycle in ApplicationContexts and are working on a serializability solution for Spring-managed scoped proxies. Watch this space!

P.S.: We are about to release a completely revised version of the good old PetClinic sample application, as a showcase for a modern Spring 3.0 web application, which will be available in a separate distribution. Keith will be blogging about this within the next couple of days.

 

 

 

 

来自: SpringSource
23
1
评论 共 7 条 请登录后发表评论
7 楼 hantsy 2009-05-10 15:32
may_cauc 写道

spring 3.0 也就是 ejb 3.1 lite 。spring 终于还是脱离了草根,回归官方了

没有那么快,按照原来的计划,应该是3.0 以后的事,可以在3.1或3.2 才能实现,会实现 web profile 中的规范,当然变数无法确定。
6 楼 banrui 2009-05-10 14:00
spring越来越强大了
5 楼 zhiweiv 2009-05-09 10:06
用m2的时候很郁闷,各种依赖弄的我都晕了。鼓捣了一个小时又换回2.5了
4 楼 may_cauc 2009-05-09 08:37
spring 3.0 也就是 ejb 3.1 lite 。spring 终于还是脱离了草根,回归官方了
3 楼 hot66hot 2009-05-09 08:10
好 我就喜欢Spring 万恶的EJB
2 楼 whaosoft 2009-05-09 00:24
基于注解的工厂方法 呵呵 和ejb3竞争吗?
1 楼 hantsy 2009-05-08 12:04
个人相当讨厌现在Spring 现在提供的 converter 和 validation 的方式,总算看到希望了。

发表评论

您还没有登录,请您登录后再发表评论

相关推荐

  • WekaManual3.7.11 manual

    WekaManual3.7.11 manual

  • vb和python语言的区别大吗_vb语言为什么被淘汰

    vb语言简介VB是Visual Basic的简写,是可视化的编程语言,是一种简单、高效地开发应用软件的工具。VB语言的特点:1、VB是一种可视化的、面向对象和采用事件驱动方式的结构化高级程序设计语言;2、可用于开发Windows环境下的各类应用程序;3、在Visual Basic环境下,利用事件驱动的编程机制、新颖易用的可视化设计工具。使用VB语言的优点:1、功能强大,可以与Windows专业开发...

  • 曾经如日中天的VB编程,现已没落,而惨遭嫌弃的它,成了香饽饽

    说到VB编程,一股莫名的亲切感,总会油然而生。它,也算是承载了一代人的青春。可以说,2000年前后,Visual Basic这个编程工具,也就是我们常说的VB,简直是火爆全网啊!但,令人遗憾的是,曾经如日中天的VB编程,现今使用人数却门可罗雀,已冷落到被淘汰的边缘。此情此景,难免令人嘘唏!众所周知,VB是微软推出来的一个可视化编程语言,它主要针对的是,Windows操作系统的32位主机。1991年,Visual Basic 1.0诞生,当时只有英文版这个版本,接下来几年,先后推出了Visual Basic

  • 有关.net 开发程序第一次慢再运行快的问题及解决办法

    原因:aspx页面在运行时,第一次访问时要进行编译,所以第一次运行慢。 解决方案:预编译 ASP.NET 网站项目可缩短用户的初始响应时间,因为页在第一次被请求时无需编译。 这对于经常更新的大型网站尤其有用。 具体步骤:打开一个命令窗口并定位到包含 .NET Framework 的文件夹。.NET Framework 将安装在以下位置。%windir%\Microsoft.NET\Framew

  • Visual Basic不可能消失(From Yesky)

    一直以来,学者们都预言Visual Basic的未来具有不确定性,这显示出人们完全误解了促成某种编程语言流行的原因,同时它还忽视了Visual Basic自身独特的精神。   近十年以来人们一直预言Visual Basic会消亡,但即使在Visual Basic.NET出现后,一切仍然没有发生变化。从最近的报道来看,VB.NET的未来受到了它的兄弟语言C#的挑战。即使过了这么多年,人们还是无法理解

  • 为VB平反

    最近我看到许多同学这样评论VB:VB早就被淘汰了,学也没用……VB就是垃圾,看它的运行效率……真慢~……今年我写的一篇《关于实现三层架构的方法--VB实现》也被因为VB被淘汰一词而被系刊打了回来。如今Java、.net满天飞,仔细想想VB可以说能和C++同辈了,也许真的应该被淘汰,但作为以VB起身的我来说,我可不这么想。我觉得现在学校里面有些学生比较浮躁,成天追求最新的编程语言

  • 【.NET】浅谈VB.NET程序开发

    ...

  • 27岁后月薪低于8K,会被淘汰吗?

    前段时间看了一篇文章,叫做《IT人为什么难以拿高薪》,颇有感触,于是写下这篇文章,希望与各位XDJM共勉~能够看到这个帖子的每个XDJM,我们大家都不是含着金钥匙出生的富二代,因此,我们的一切成就需要自己的努力,这里面有痛苦,有彷徨,有挫折,我们是否能够咬牙坚持下去?首 先,在中国这么一个人口众多的国家,尤其是在北京、上海这种一线城市,如何脱颖而出很重要,本科学历,四级证书已经成了最基本的标志(这里没有任何歧视意 义,但是如果没有学历,很多垃圾公司会连面试的机会都不给),不用给我讲个例说有些人高中没毕业

  • java、c、c++、vc、vc++、vb的区别和联系

     java:分三大平台 java se (j2se),java ee(j2ee),java me(j2me) java se是java ee和java me的基础 java ee是目前位置企业级开发平台中最牛的 java me是用来开发移动嵌入式程序的,例如手机游戏 java 的优点是非常适合用于开发大型企业级项目,我们曾为网通公司开发过的上千万级的项目,用的后台程序就是java ee。 ja

  • .net与linux

    Mono是什么? http://blog.sina.com.cn/s/blog_693ffe760100k5uh.html   Mono是一个开放源代码,Linux版的Microsfot.NET开发平台Mono项目将使开发者开发的.NET应用程序不仅能在windows平台上运行, 也能在任何支持Mono的平台上运行,包括Linux,Unix. Mono项目将使大家能开发出各种跨平台的应用程序...

  • java集合详解

    1.java集合是什么? java集合实际上是一种经常被运用到的java类库,其中提供了已经实现的的数据结构,省去了程序员再次编写数据结构的事情.在Leetcode中经常会被用到,有很重要的作用. 集合体系 我们发现,无论是Set和List都是继承于Collection接口,实现Collection之中的方法,而他们又衍生出了HashSet,LinkedList等等我们经...

Global site tag (gtag.js) - Google Analytics