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.
7 楼 hantsy 2009-05-10 15:32
spring 3.0 也就是 ejb 3.1 lite 。spring 终于还是脱离了草根,回归官方了
没有那么快,按照原来的计划,应该是3.0 以后的事,可以在3.1或3.2 才能实现,会实现 web profile 中的规范,当然变数无法确定。
6 楼 banrui 2009-05-10 14:00
5 楼 zhiweiv 2009-05-09 10:06
4 楼 may_cauc 2009-05-09 08:37
3 楼 hot66hot 2009-05-09 08:10
2 楼 whaosoft 2009-05-09 00:24
1 楼 hantsy 2009-05-08 12:04