本文同不至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定義配置文件所影響的佔位符屬性