Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
爱吃血肠
spring-framework
提交
57e765f9
S
spring-framework
项目概览
爱吃血肠
/
spring-framework
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
spring-framework
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
57e765f9
编写于
5月 22, 2015
作者:
S
Sam Brannen
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Document annotation improvements & @AliasFor in new-in-4.2
上级
9983add0
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
1 deletion
+53
-1
src/asciidoc/whats-new.adoc
src/asciidoc/whats-new.adoc
+53
-1
未找到文件。
src/asciidoc/whats-new.adoc
浏览文件 @
57e765f9
...
...
@@ -398,6 +398,57 @@ method has been added.
annotation-based model>> as well as the ability to publish any arbitrary event.
** Any public method in a managed bean can be annotated with `@EventListener` to consume events.
** `@TransactionalEventListener` provides transaction-bound event support.
* Spring Framework 4.2 introduces first-class support for declaring and
looking up aliases for annotation attributes. The new `@AliasFor`
annotation can be used to declare a pair of aliased attributes within
a single annotation or to declare an alias from one attribute in a
custom composed annotation to an attribute in a meta-annotation.
** The following annotations have been retrofitted with `@AliasFor`
support: `@ManagedResource`, `@ContextConfiguration`,
`@ActiveProfiles`, `@TestExecutionListeners`, `@TestPropertySource`,
`@Sql`, `@ControllerAdvice`, `@RequestMapping`.
** For example, `@ContextConfiguration` from the `spring-test` module
is now declared as follows:
[source,java,indent=0]
[subs="verbatim,quotes"]
----
public @interface ContextConfiguration {
@AliasFor(attribute = "locations")
String[] value() default {};
@AliasFor(attribute = "value")
String[] locations() default {};
// ...
}
----
** Similarly, _composed annotations_ that override attributes from
meta-annotations can now use `@AliasFor` for fine-grained control
over exactly which attributes are overridden within an annotation
hierarchy. In fact, it is now possible to declare an alias for the
`value` attribute of a meta-annotation.
** For example, one can now develop a composed annotation with a custom
attribute override as follows.
[source,java,indent=0]
[subs="verbatim,quotes"]
----
@ContextConfiguration
public @interface MyTestConfig {
@AliasFor(annotation = ContextConfiguration.class, attribute = "locations")
String[] xmlFiles();
// ...
}
----
* Numerous improvements to Spring's search algorithms used for finding
meta-annotations. For example, locally declared _composed annotations_
are now favored over inherited annotations.
* _Composed annotations_ that override attributes from meta-annotations
can now be discovered on interfaces and on abstract, bridge, & interface
methods as well as on classes, standard methods, constructors, and
fields.
* The features of field-based data binding (`DirectFieldAccessor`) have been aligned with the current
property-based data binding (`BeanWrapper`). In particular, field-based binding now supports
navigation for Collections, Arrays, and Maps.
...
...
@@ -406,7 +457,8 @@ method has been added.
`ConversionService` as well.
* `JavaMailSenderImpl` has a new `testConnection()` method for checking connectivity to the server.
* `ScheduledTaskRegistrar` exposes scheduled tasks.
* Support for Apache `commons-pool2`
* Apache `commons-pool2` is now supported.
* `@NumberFormat` can now be used as a meta-annotation.
=== Data Access Improvements
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录