6. New Features and Enhancements in Spring Framework 4.3

6.1 Core Container Improvements

  • It is no longer necessary to specify the @Autowired annotation if the target bean only define one constructor.
  • @Configuration classes support constructor injection.
  • Any SpEL expression used to specify the condition of an @EventListener can now refer to beans (i.e. @beanName.method()).

6.2 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.

6.3 Web Improvements

  • New @RestControllerAdvice annotation combines @ControllerAdvice with @ResponseBody.
  • AsyncRestTemplate supports request interception.

6.4 Testing Improvements

  • The JUnit support in the Spring TestContext Framework now requires JUnit 4.12 or higher.