本文同不至http://www.waylau.com/new-features-and-enhancements-in-spring-framework-4.2/html
至今为止,Spring Framework 的最新版本为 4.2.1.RELEASE。 那么 Spring Framework 4.2 中的又有哪些新功能和加强功能呢?java
<!-- more -->git
下面的注解已加了 @AliasFor 为了支持提供更有意义的 value 属性的别名: @Cacheable, @CacheEvict, @CachePut, @ComponentScan, @ComponentScan.Filter, @ImportResource, @Scope, @ManagedResource, @Header, @Payload, @SendToUser, @ActiveProfiles, @ContextConfiguration, @Sql, @TestExecutionListeners, @TestPropertySource, @Transactional, @ControllerAdvice, @CookieValue, @CrossOrigin, @MatrixVariable, @RequestHeader, @RequestMapping, @RequestParam, @RequestPart, @ResponseStatus, @SessionAttributes, @ActionMapping, @RenderMapping, @EventListener, @TransactionalEventListenergithub
例如,spring-test 的 @ContextConfiguration 如今声明以下:web
public @interface ContextConfiguration {算法
@AliasFor("locations") String[] value() default {}; @AliasFor("value") String[] locations() default {}; // ...
}spring
一样, 组合注解(composed annotations)从元注解覆盖的属性,如今可使用 @AliasFor 进行细粒度控制哪些属性是覆盖在一个注释的层次结构。事实上,如今能够声明一个别名给元注释的 value 属性。数据库
例如,开发一个组合注解用于一个自定义的属性的覆盖数组
@ContextConfiguration public @interface MyTestConfig {spring-mvc
@AliasFor(annotation = ContextConfiguration.class, attribute = "value") String[] xmlFiles(); // ...
}
lang:std
元素暴露。支持如 JavaScript 和 JRuby。(注意:JRubyScriptFactory 和 lang:jruby
如今不推荐使用了 , 推荐用 JSR-223)<jdbc:embedded-database>
支持新的 database-name 属性。见下面“测试改进”内容{}&&
改成更安全的)]}’,
List<Foo>
<jdbc:embedded-database>
的 database-name 属性,容许开发人员为嵌入式数据库设置独特的名字——例如,经过一个 SpEL 表达式或 前活动bean定义配置文件所影响的占位符属性