diff options
Diffstat (limited to 'src/asciidoc/whats-new.adoc')
-rw-r--r-- | src/asciidoc/whats-new.adoc | 128 |
1 files changed, 122 insertions, 6 deletions
diff --git a/src/asciidoc/whats-new.adoc b/src/asciidoc/whats-new.adoc index 5ad8910d..bb1cb1e5 100644 --- a/src/asciidoc/whats-new.adoc +++ b/src/asciidoc/whats-new.adoc @@ -276,7 +276,7 @@ Spring 4.1 also improves its own caching abstraction significantly: common settings to be shared at the class level **without** enabling any cache operation. * Better exception handling of cached methods using `CacheErrorHandler` -Spring 4.1 also has a breaking change in the `CacheInterface` as a new `putIfAbsent` +Spring 4.1 also has a breaking change in the `Cache` interface as a new `putIfAbsent` method has been added. === Web Improvements @@ -368,9 +368,9 @@ method has been added. * Test property sources which automatically override system and application property sources can be configured via the new `@TestPropertySource` annotation. ** See <<testcontext-ctx-management-property-sources>> for details. -* Default ++TestExecutionListener++s can now be automatically discovered. +* Default ``TestExecutionListener``s can now be automatically discovered. ** See <<testcontext-tel-config-automatic-discovery>> for details. -* Custom ++TestExecutionListener++s can now be automatically merged with the default +* Custom ``TestExecutionListener``s can now be automatically merged with the default listeners. ** See <<testcontext-tel-config-merging>> for details. * The documentation for transactional testing support in the TestContext framework has @@ -597,13 +597,13 @@ public @interface MyTestConfig { subsequent release. * `@Sql` now supports execution of _inlined SQL statements_ via a new `statements` attribute. -* The `ContextCache` that is used for caching ++ApplicationContext++s +* The `ContextCache` that is used for caching ``ApplicationContext``s between tests is now a public API with a default implementation that can be replaced for custom caching needs. * `DefaultTestContext`, `DefaultBootstrapContext`, and `DefaultCacheAwareContextLoaderDelegate` are now public classes in the `support` subpackage, allowing for custom extensions. -* ++TestContextBootstrapper++s are now responsible for building the +* ``TestContextBootstrapper``s are now responsible for building the `TestContext`. * In the Spring MVC Test framework, `MvcResult` details can now be logged at `DEBUG` level or written to a custom `OutputStream` or `Writer`. See @@ -616,9 +616,125 @@ public @interface MyTestConfig { definition profiles. * Embedded databases can now be automatically assigned a unique name, allowing common test database configuration to be reused in different - ++ApplicationContext++s within a test suite. + ``ApplicationContext``s within a test suite. ** See <<jdbc-embedded-database-unique-names>> for details. * `MockHttpServletRequest` and `MockHttpServletResponse` now provide better support for date header formatting via the `getDateHeader` and `setDateHeader` methods. + + +[[new-in-4.3]] +== New Features and Enhancements in Spring Framework 4.3 + +=== Core Container Improvements + +* Core container exceptions provide richer metadata to evaluate programmatically. +* Java 8 default methods get detected as bean property getters/setters. +* It is no longer necessary to specify the `@Autowired` annotation if the target + bean only defines one constructor. +* `@Configuration` classes support constructor injection. +* Any SpEL expression used to specify the `condition` of an `@EventListener` can + now refer to beans (e.g. `@beanName.method()`). +* _Composed annotations_ can now override array attributes in meta-annotations + with a single element of the component type of the array. For example, the + `String[] path` attribute of `@RequestMapping` can be overridden with + `String path` in a composed annotation. +* `@Scheduled` and `@Schedules` may now be used as _meta-annotations_ to create + custom _composed annotations_ with attribute overrides. +* `@Scheduled` is properly supported on beans of any scope. + +=== Data Access Improvements + +* `jdbc:initialize-database` and `jdbc:embedded-database` support a configurable + separator to be applied to each script. + +=== Caching Improvements + +Spring 4.3 allows concurrent calls on a given key to be synchronized so that the +value is only computed once. This is an opt-in feature that should be enabled via +the new `sync` attribute on `@Cacheable`. This features introduces a breaking +change in the `Cache` interface as a `get(Object key, Callable<T> valueLoader)` +method has been added. + +Spring 4.3 also improves the caching abstraction as follows: + +* SpEL expressions in caches-related annotations can now refer to beans (i.e. + `@beanName.method()`). +* `ConcurrentMapCacheManager` and `ConcurrentMapCache` now support the serialization + of cache entries via a new `storeByValue` attribute. +* `@Cacheable`, `@CacheEvict`, `@CachePut`, and `@Caching` may now be used as + _meta-annotations_ to create custom _composed annotations_ with attribute overrides. + +=== JMS Improvements + +* `@SendTo` can now be specified at the class level to share a common reply destination. +* `@JmsListener` and `@JmsListeners` may now be used as _meta-annotations_ to create + custom _composed annotations_ with attribute overrides. + +=== Web Improvements + +* Built-in support for <<mvc-ann-requestmapping-head-options,HTTP HEAD and HTTP OPTIONS>>. +* New `@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping` + _composed annotations_ for `@RequestMapping`. +** See <<mvc-ann-requestmapping-composed,Composed @RequestMapping Variants>> for details. +* New `@RequestScope`, `@SessionScope`, and `@ApplicationScope` _composed annotations_ + for web scopes. +** See <<beans-factory-scopes-request,Request scope>>, + <<beans-factory-scopes-session,Session scope>>, and + <<beans-factory-scopes-application,Application scope>> for details. +* New `@RestControllerAdvice` annotation with combined `@ControllerAdvice` with `@ResponseBody` semantics. +* `@ResponseStatus` is now supported at the class level and inherited by all methods. +* New `@SessionAttribute` annotation for access to session attributes (see <<mvc-ann-sessionattrib-global, example>>). +* New `@RequestAttribute` annotation for access to request attributes (see <<mvc-ann-requestattrib, example>>). +* `@ModelAttribute` allows preventing data binding via `binding=false` attribute (see <<mvc-ann-modelattrib-method-args, reference>>). +* Consistent exposure of Errors and custom Throwables to MVC exception handlers. +* Consistent charset handling in HTTP message converters, including a UTF-8 default for multipart text content. +* Static resource handling uses the configured `ContentNegotiationManager` for media type determination. +* `RestTemplate` and `AsyncRestTemplate` support strict URI variable encoding via `DefaultUriTemplateHandler`. +* `AsyncRestTemplate` supports request interception. + +=== WebSocket Messaging Improvements + +* `@SendTo` and `@SendToUser` can now be specified at class-level to share a common destination. + +=== Testing Improvements + +* The JUnit support in the _Spring TestContext Framework_ now requires JUnit 4.12 or higher. +* New `SpringRunner` _alias_ for the `SpringJUnit4ClassRunner`. +* Test related annotations may now be declared on interfaces -- for example, for use with + _test interfaces_ that make use of Java 8 based interface default methods. +* An empty declaration of `@ContextConfiguration` can now be completely omitted if default + XML files, Groovy scripts, or `@Configuration` classes are detected. +* `@Transactional` test methods are no longer required to be `public` (e.g., in TestNG and JUnit 5). +* `@BeforeTransaction` and `@AfterTransaction` methods are no longer required to be `public` + and may now be declared on Java 8 based interface default methods. +* The `ApplicationContext` cache in the _Spring TestContext Framework_ is now bounded with a + default maximum size of 32 and a _least recently used_ eviction policy. The maximum size + can be configured by setting a JVM system property or Spring property called + `spring.test.context.cache.maxSize`. +* New `ContextCustomizer` API for customizing a test `ApplicationContext` _after_ bean + definitions have been loaded into the context but _before_ the context has been refreshed. + Customizers can be registered globally by third parties, foregoing the need to implement a + custom `ContextLoader`. +* `@Sql` and `@SqlGroup` may now be used as _meta-annotations_ to create custom _composed + annotations_ with attribute overrides. +* `ReflectionTestUtils` now automatically unwraps proxies when setting or getting a field. +* Server-side Spring MVC Test supports expectations on response headers with multiple values. +* Server-side Spring MVC Test parses form data request content and populates request parameters. +* Server-side Spring MVC Test supports mock-like assertions for invoked handler methods. +* Client-side REST test support allows indicating how many times a request is expected and + whether the order of declaration for expectations should be ignored (see <<spring-mvc-test-client>>). +* Client-side REST Test supports expectations for form data in the request body. + +=== Support for new library and server generations + +* Hibernate ORM 5.2 (still supporting 4.2/4.3 and 5.0/5.1 as well, with 3.6 deprecated now) +* Jackson 2.8 (minimum raised to Jackson 2.6+ as of Spring 4.3) +* OkHttp 3.x (still supporting OkHttp 2.x side by side) +* Netty 4.1 +* Undertow 1.4 +* Tomcat 8.5.2 as well as 9.0 M6 + +Furthermore, Spring Framework 4.3 embeds the updated ASM 5.1 and Objenesis 2.4 in +`spring-core.jar`. |