Remove the What's new in Spring 3 from docs

Remove the entire What's new in Spring 3 section from the reference
documentation.
This commit is contained in:
Brian Clozel
2013-12-11 12:09:50 -08:00
committed by Phillip Webb
parent 7e1e99d272
commit 8b48ba2af3

View File

@@ -772,904 +772,6 @@ the exact version and feature set of the container.
[[spring-whats-new]]
= What's New in Spring 3
[[new-in-3.0]]
== New Features and Enhancements in Spring Framework 3.0
If you have been using the Spring Framework for some time, you will be aware that Spring
has undergone two major revisions: Spring 2.0, released in October 2006, and Spring 2.5,
released in November 2007. It is now time for a third overhaul resulting in Spring
Framework 3.0.
.Java SE and Java EE Support
****
The Spring Framework is now based on Java 5, and Java 6 is fully supported.
Furthermore, Spring is compatible with J2EE 1.4 and Java EE 5, while at the same time
introducing some early support for Java EE 6.
****
[[new-in-3.0-intro]]
=== Java 5
The entire framework code has been revised to take advantage of Java 5 features like
generics, varargs and other language improvements. We have done our best to still keep
the code backwards compatible. We now have consistent use of generic Collections and
Maps, consistent use of generic FactoryBeans, and also consistent resolution of bridge
methods in the Spring AOP API. Generic ApplicationListeners automatically receive
specific event types only. All callback interfaces such as TransactionCallback and
HibernateCallback declare a generic result value now. Overall, the Spring core codebase
is now freshly revised and optimized for Java 5.
Spring's TaskExecutor abstraction has been updated for close integration with Java 5's
java.util.concurrent facilities. We provide first-class support for Callables and
Futures now, as well as ExecutorService adapters, ThreadFactory integration, etc. This
has been aligned with JSR-236 (Concurrency Utilities for Java EE 6) as far as possible.
Furthermore, we provide support for asynchronous method invocations through the use of
the new @Async annotation (or EJB 3.1's @Asynchronous annotation).
[[new-in-3.0-improved-docs]]
=== Improved documentation
The Spring reference documentation has also substantially been updated to reflect all of
the changes and new features for Spring Framework 3.0. While every effort has been made
to ensure that there are no errors in this documentation, some errors may nevertheless
have crept in. If you do spot any typos or even more serious errors, and you can spare a
few cycles during lunch, please do bring the error to the attention of the Spring team
by http://jira.springframework.org/[raising an issue].
[[new-in-3.0-new-tutorial]]
=== New articles and tutorials
There are many excellent articles and tutorials that show how to get started with Spring
Framework 3 features. Read them at the http://spring.io/docs[Spring Documentation] page.
The samples have been improved and updated to take advantage of the new features in
Spring Framework 3. Additionally, the samples have been moved out of the source tree
into a dedicated SVN https://anonsvn.springframework.org/svn/spring-samples/[repository]
available at:
`https://anonsvn.springframework.org/svn/spring-samples/`
As such, the samples are no longer distributed alongside Spring Framework 3 and need to
be downloaded separately from the repository mentioned above. However, this
documentation will continue to refer to some samples (in particular Petclinic) to
illustrate various features.
[NOTE]
====
For more information on Subversion (or in short SVN), see the project homepage at:
`http://subversion.apache.org/`
====
[[new-in-3.0-modules-build]]
=== New module organization and build system
The framework modules have been revised and are now managed separately with one
source-tree per module jar:
* org.springframework.aop
* org.springframework.beans
* org.springframework.context
* org.springframework.context.support
* org.springframework.expression
* org.springframework.instrument
* org.springframework.jdbc
* org.springframework.jms
* org.springframework.orm
* org.springframework.oxm
* org.springframework.test
* org.springframework.transaction
* org.springframework.web
* org.springframework.web.portlet
* org.springframework.web.servlet
* org.springframework.web.struts
NOTE: The spring.jar artifact that contained almost the entire framework is no longer
provided.
We are now using a new Spring build system as known from Spring Web Flow 2.0. This gives
us:
* Ivy-based "Spring Build" system
* consistent deployment procedure
* consistent dependency management
* consistent generation of OSGi manifests
[[new-in-3.0-features-overview]]
=== Overview of new features
This is a list of new features for Spring Framework 3.0. We will cover these features in
more detail later in this section.
* Spring Expression Language
* IoC enhancements/Java based bean metadata
* General-purpose type conversion system and field formatting system
* Object to XML mapping functionality (OXM) moved from Spring Web Services project
* Comprehensive REST support
* @MVC additions
* Declarative model validation
* Early support for Java EE 6
* Embedded database support
[[new-feature-java5]]
==== Core APIs updated for Java 5
BeanFactory interface returns typed bean instances as far as possible:
* T getBean(Class<T> requiredType)
* T getBean(String name, Class<T> requiredType)
* Map<String, T> getBeansOfType(Class<T> type)
Spring's TaskExecutor interface now extends `java.util.concurrent.Executor`:
* extended AsyncTaskExecutor supports standard Callables with Futures
New Java 5 based converter API and SPI:
* stateless ConversionService and Converters
* superseding standard JDK PropertyEditors
Typed ApplicationListener<E>
[[new-feature-el]]
==== Spring Expression Language
Spring introduces an expression language which is similar to Unified EL in its syntax
but offers significantly more features. The expression language can be used when
defining XML and Annotation based bean definitions and also serves as the foundation for
expression language support across the Spring portfolio. Details of this new
functionality can be found in the chapter <<expressions,Spring Expression Language
(SpEL).>>
The Spring Expression Language was created to provide the Spring community a single,
well supported expression language that can be used across all the products in the
Spring portfolio. Its language features are driven by the requirements of the projects
in the Spring portfolio, including tooling requirements for code completion support
within the Eclipse based http://www.springsource.com/products/sts[SpringSource Tool
Suite].
The following is an example of how the Expression Language can be used to configure some
properties of a database setup
[source,xml]
[subs="verbatim,quotes"]
----
<bean class="mycompany.RewardsTestDatabase">
<property name="databaseName"
value="#{systemProperties.databaseName}"/>
<property name="keyGenerator"
value="#{strategyBean.databaseKeyGenerator}"/>
</bean>
----
This functionality is also available if you prefer to configure your components using
annotations:
[source,java]
[subs="verbatim,quotes"]
----
@Repository
public class RewardsTestDatabase {
@Value("#{systemProperties.databaseName}")
public void setDatabaseName(String dbName) { ... }
@Value("#{strategyBean.databaseKeyGenerator}")
public void setKeyGenerator(KeyGenerator kg) { ... }
}
----
[[new-feature-java-config]]
==== The Inversion of Control (IoC) container
[[new-java-configuration]]
===== Java based bean metadata
Some core features from the JavaConfig project have been added to the Spring Framework
now. This means that the following annotations are now directly supported:
* @Configuration
* @Bean
* @DependsOn
* @Primary
* @Lazy
* @Import
* @ImportResource
* @Value
Here is an example of a Java class providing basic configuration using the new
JavaConfig features:
[source,java]
[subs="verbatim,quotes"]
----
package org.example.config;
@Configuration
public class AppConfig {
private @Value("#{jdbcProperties.url}") String jdbcUrl;
private @Value("#{jdbcProperties.username}") String username;
private @Value("#{jdbcProperties.password}") String password;
@Bean
public FooService fooService() {
return new FooServiceImpl(fooRepository());
}
@Bean
public FooRepository fooRepository() {
return new HibernateFooRepository(sessionFactory());
}
@Bean
public SessionFactory sessionFactory() {
// wire up a session factory
AnnotationSessionFactoryBean asFactoryBean =
new AnnotationSessionFactoryBean();
asFactoryBean.setDataSource(dataSource());
// additional config
return asFactoryBean.getObject();
}
@Bean
public DataSource dataSource() {
return new DriverManagerDataSource(jdbcUrl, username, password);
}
}
----
To get this to work you need to add the following component
scanning entry in your minimal application context XML file.
[source,xml]
[subs="verbatim,quotes"]
----
<context:component-scan base-package="org.example.config"/>
<util:properties id="jdbcProperties" location="classpath:org/example/config/jdbc.properties"/>
----
Or you can bootstrap a `@Configuration` class directly using
`AnnotationConfigApplicationContext`:
[source,java]
[subs="verbatim,quotes"]
----
public static void main(String[] args) {
ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
FooService fooService = ctx.getBean(FooService.class);
fooService.doStuff();
}
----
See <<beans-java-instantiating-container>> for full information on
`AnnotationConfigApplicationContext`.
[[new-bean-metadata-in-components]]
===== Defining bean metadata within components
`@Bean` annotated methods are also supported inside Spring components. They contribute a
factory bean definition to the container. See <<beans-factorybeans-annotations,Defining
bean metadata within components>> for more information
[[new-feature-convert-and-format]]
==== General purpose type conversion system and field formatting system
A general purpose <<core-convert,type conversion system>> has been introduced. The
system is currently used by SpEL for type conversion, and may also be used by a Spring
Container and DataBinder when binding bean property values.
In addition, a <<format,formatter>> SPI has been introduced for formatting field values.
This SPI provides a simpler and more robust alternative to JavaBean PropertyEditors for
use in client environments such as Spring MVC.
[[new-feature-oxm]]
==== The Data Tier
Object to XML mapping functionality (OXM) from the Spring Web Services project has been
moved to the core Spring Framework now. The functionality is found in the
`org.springframework.oxm` package. More information on the use of the `OXM` module can
be found in the <<oxm,Marshalling XML using O/X Mappers>> chapter.
[[new-feature-rest]]
==== The Web Tier
The most exciting new feature for the Web Tier is the support for building RESTful web
services and web applications. There are also some new annotations that can be used in
any web application.
[[new-feature-rest-support]]
===== Comprehensive REST support
Server-side support for building RESTful applications has been provided as an extension
of the existing annotation driven MVC web framework. Client-side support is provided by
the `RestTemplate` class in the spirit of other template classes such as `JdbcTemplate`
and `JmsTemplate`. Both server and client side REST functionality make use of
`HttpConverter` s to facilitate the conversion between objects and their representation
in HTTP requests and responses.
The `MarshallingHttpMessageConverter` uses the __Object to XML mapping__ functionality
mentioned earlier.
Refer to the sections on <<mvc,MVC>> and <<rest-resttemplate,the RestTemplate>> for more
information.
[[new-feature-at-mvc]]
===== @MVC additions
A `mvc` namespace has been introduced that greatly simplifies Spring MVC configuration.
Additional annotations such as `@CookieValue` and `@RequestHeaders` have been added. See
<<mvc-ann-cookievalue,Mapping cookie values with the @CookieValue annotation>> and
<<mvc-ann-requestheader,Mapping request header attributes with the @RequestHeader
annotation>> for more information.
[[new-feature-validation]]
==== Declarative model validation
Several <<validation-beanvalidation,validation enhancements>>, including JSR 303 support
that uses Hibernate Validator as the default provider.
[[new-feature-jee-6]]
==== Early support for Java EE 6
We provide support for asynchronous method invocations through the use of the new @Async
annotation (or EJB 3.1's @Asynchronous annotation).
JSR 303, JSF 2.0, JPA 2.0, etc
[[new-feature-embedded-databases]]
==== Support for embedded databases
Convenient support for <<jdbc-embedded-database-support,embedded Java database
engines>>, including HSQL, H2, and Derby, is now provided.
[[new-in-3.1]]
== New Features and Enhancements in Spring Framework 3.1
This is a list of new features for Spring Framework 3.1. A number of features do not
have dedicated reference documentation but do have complete Javadoc. In such cases,
fully-qualified class names are given. See also <<migration-3.1>>
[[new-in-3.1-cache-abstraction]]
=== Cache Abstraction
* <<cache>>
* http://spring.io/blog/2011/02/23/spring-3-1-m1-cache-abstraction/[Cache Abstraction]
(SpringSource team blog)
[[new-in-3.1-bean-definition-profiles]]
=== Bean Definition Profiles
* http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/[XML
profiles] (SpringSource Team Blog)
* http://blog.springsource.com/2011/02/14/spring-3-1-m1-introducing-profile/[Introducing
@Profile] (SpringSource Team Blog)
* See org.springframework.context.annotation.Configuration Javadoc
* See org.springframework.context.annotation.Profile Javadoc
[[new-in-3.1-environment-abstraction]]
=== Environment Abstraction
* http://blog.springsource.com/2011/02/11/spring-framework-3-1-m1-released/[Environment
Abstraction] (SpringSource Team Blog)
* See org.springframework.core.env.Environment Javadoc
[[new-in-3.1-property-source-abstraction]]
=== PropertySource Abstraction
* http://blog.springsource.com/2011/02/15/spring-3-1-m1-unified-property-management/[Unified
Property Management] (SpringSource Team Blog)
* See org.springframework.core.env.Environment Javadoc
* See org.springframework.core.env.PropertySource Javadoc
* See org.springframework.context.annotation.PropertySource Javadoc
[[new-in-3.1-code-equivalent-xml-namespaces]]
=== Code equivalents for Spring's XML namespaces
Code-based equivalents to popular Spring XML namespace elements
<context:component-scan/>, <tx:annotation-driven/> and <mvc:annotation-driven> have been
developed, most in the form of `@Enable` annotations. These are designed for use in
conjunction with Spring's `@Configuration` classes, which were introduced in Spring
Framework 3.0.
* See org.springframework.context.annotation.Configuration Javadoc
* See org.springframework.context.annotation.ComponentScan Javadoc
* See org.springframework.transaction.annotation.EnableTransactionManagement Javadoc
* See org.springframework.cache.annotation.EnableCaching Javadoc
* See org.springframework.web.servlet.config.annotation.EnableWebMvc Javadoc
* See org.springframework.scheduling.annotation.EnableScheduling Javadoc
* See org.springframework.scheduling.annotation.EnableAsync Javadoc
* See org.springframework.context.annotation.EnableAspectJAutoProxy Javadoc
* See org.springframework.context.annotation.EnableLoadTimeWeaving Javadoc
* See org.springframework.beans.factory.aspectj.EnableSpringConfigured Javadoc
[[new-in-3.1-hibernate-4-support]]
=== Support for Hibernate 4.x
* See Javadoc for classes within the new org.springframework.orm.hibernate4 package
[[new-in-3.1-test-context-profiles]]
=== TestContext framework support for @Configuration classes and bean definition profiles
The `@ContextConfiguration` annotation now supports supplying `@Configuration` classes
for configuring the Spring `TestContext`. In addition, a new `@ActiveProfiles`
annotation has been introduced to support declarative configuration of active bean
definition profiles in `ApplicationContext` integration tests.
* http://blog.springsource.com/2011/06/21/spring-3-1-m2-testing-with-configuration-classes-and-profiles/[Spring
3.1 M2: Testing with @Configuration Classes and Profiles] (SpringSource Team Blog)
* See <<testcontext-framework>>
* See <<testcontext-ctx-management-javaconfig>> and
`org.springframework.test.context.ContextConfiguration` Javadoc
* See `org.springframework.test.context.ActiveProfiles` Javadoc
* See `org.springframework.test.context.SmartContextLoader` Javadoc
* See `org.springframework.test.context.support.DelegatingSmartContextLoader` Javadoc
* See `org.springframework.test.context.support.AnnotationConfigContextLoader` Javadoc
[[new-in-3.1-c-namespace]]
=== c: namespace for more concise constructor injection
* <<beans-c-namespace>>
[[new-in-3.1-injection-non-javabeans-setters]]
=== Support for injection against non-standard JavaBeans setters
Prior to Spring Framework 3.1, in order to inject against a property method it had to
conform strictly to JavaBeans property signature rules, namely that any 'setter' method
must be void-returning. It is now possible in Spring XML to specify setter methods that
return any object type. This is useful when considering designing APIs for
method-chaining, where setter methods return a reference to 'this'.
[[new-in-3.1-servlet-3-code-config]]
=== Support for Servlet 3 code-based configuration of Servlet Container
The new `WebApplicationInitializer` builds atop Servlet 3.0's
`ServletContainerInitializer` support to provide a programmatic alternative to the
traditional web.xml.
* See org.springframework.web.WebApplicationInitializer Javadoc
* http://bit.ly/lrDHja[Diff from Spring's Greenhouse reference application]
demonstrating migration from web.xml to `WebApplicationInitializer`
[[new-in-3.1-servlet-3-multipart-resolver]]
=== Support for Servlet 3 MultipartResolver
* See org.springframework.web.multipart.support.StandardServletMultipartResolver Javadoc
[[new-in-3.1-jpa-without-xml]]
=== JPA EntityManagerFactory bootstrapping without persistence.xml
In standard JPA, persistence units get defined through `META-INF/persistence.xml` files
in specific jar files which will in turn get searched for `@Entity` classes. In many
cases, persistence.xml does not contain more than a unit name and relies on defaults
and/or external setup for all other concerns (such as the DataSource to use, etc). For
that reason, Spring Framework 3.1 provides an alternative:
`LocalContainerEntityManagerFactoryBean` accepts a 'packagesToScan' property, specifying
base packages to scan for `@Entity` classes. This is analogous to
`AnnotationSessionFactoryBean`'s property of the same name for native Hibernate setup,
and also to Spring's component-scan feature for regular Spring beans. Effectively, this
allows for XML-free JPA setup at the mere expense of specifying a base package for
entity scanning: a particularly fine match for Spring applications which rely on
component scanning for Spring beans as well, possibly even bootstrapped using a
code-based Servlet 3.0 initializer.
[[new-in-3.1-handler-method-controller-processing]]
=== New HandlerMethod-based Support Classes For Annotated Controller Processing
Spring Framework 3.1 introduces a new set of support classes for processing requests
with annotated controllers:
* `RequestMappingHandlerMapping`
* `RequestMappingHandlerAdapter`
* `ExceptionHandlerExceptionResolver`
These classes are a replacement for the existing:
* `DefaultAnnotationHandlerMapping`
* `AnnotationMethodHandlerAdapter`
* `AnnotationMethodHandlerExceptionResolver`
The new classes were developed in response to many requests to make annotation
controller support classes more customizable and open for extension. Whereas previously
you could configure a custom annotated controller method argument resolver, with the new
support classes you can customize the processing for any supported method argument or
return value type.
* See org.springframework.web.method.support.HandlerMethodArgumentResolver Javadoc
* See org.springframework.web.method.support.HandlerMethodReturnValueHandler Javadoc
A second notable difference is the introduction of a `HandlerMethod` abstraction to
represent an `@RequestMapping` method. This abstraction is used throughout by the new
support classes as the `handler` instance. For example a `HandlerInterceptor` can cast
the `handler` from `Object` to `HandlerMethod` and get access to the target controller
method, its annotations, etc.
The new classes are enabled by default by the MVC namespace and by Java-based
configuration via `@EnableWebMvc`. The existing classes will continue to be available
but use of the new classes is recommended going forward.
See <<mvc-ann-requestmapping-31-vs-30>> for additional details and a list of features
not available with the new support classes.
[[new-in-3.1-request-mapping-consumes-produces]]
=== "consumes" and "produces" conditions in @RequestMapping
Improved support for specifying media types consumed by a method through the
`'Content-Type'` header as well as for producible types specified through the `'Accept'`
header. See <<mvc-ann-requestmapping-consumes>> and <<mvc-ann-requestmapping-produces>>
[[new-in-3.1-flash-redirect-attributes]]
=== Flash Attributes and RedirectAttributes
Flash attributes can now be stored in a `FlashMap` and saved in the HTTP session to
survive a redirect. For an overview of the general support for flash attributes in
Spring MVC see <<mvc-flash-attributes>>.
In annotated controllers, an `@RequestMapping` method can add flash attributes by
declaring a method argument of type `RedirectAttributes`. This method argument can now
also be used to get precise control over the attributes used in a redirect scenario. See
<<mvc-ann-redirect-attributes>> for more details.
[[new-in-3.1-uri-template-var-enhancements]]
=== URI Template Variable Enhancements
URI template variables from the current request are used in more places:
* URI template variables are used in addition to request parameters when binding a
request to `@ModelAttribute` method arguments.
* @PathVariable method argument values are merged into the model before rendering,
except in views that generate content in an automated fashion such as JSON
serialization or XML marshalling.
* A redirect string can contain placeholders for URI variables (e.g.
`"redirect:/blog/{year}/{month}"`). When expanding the placeholders, URI template
variables from the current request are automatically considered.
* An `@ModelAttribute` method argument can be instantiated from a URI template variable
provided there is a registered Converter or PropertyEditor to convert from a String to
the target object type.
[[new-in-3.1-mvc-valid-requestbody]]
=== @Valid On @RequestBody Controller Method Arguments
An `@RequestBody` method argument can be annotated with `@Valid` to invoke automatic
validation similar to the support for `@ModelAttribute` method arguments. A resulting
`MethodArgumentNotValidException` is handled in the `DefaultHandlerExceptionResolver`
and results in a `400` response code.
[[new-in-3.1-mvc-requestpart]]
=== @RequestPart Annotation On Controller Method Arguments
This new annotation provides access to the content of a "multipart/form-data" request
part. See <<mvc-multipart-forms-non-browsers>> and <<mvc-multipart>>.
[[new-in-3.1-mvc-uricomponentsbuilder]]
=== UriComponentsBuilder and UriComponents
A new `UriComponents` class has been added, which is an immutable container of URI
components providing access to all contained URI components. A new
`UriComponentsBuilder` class is also provided to help create `UriComponents` instances.
Together the two classes give fine-grained control over all aspects of preparing a URI
including construction, expansion from URI template variables, and encoding.
In most cases the new classes can be used as a more flexible alternative to the existing
`UriTemplate` especially since `UriTemplate` relies on those same classes internally.
A `ServletUriComponentsBuilder` sub-class provides static factory methods to copy
information from a Servlet request. See <<mvc-construct-encode-uri>>.
[[new-in-3.2]]
== New Features and Enhancements in Spring Framework 3.2
This section covers what's new in Spring Framework 3.2. See also <<migration-3.2>>
[[new-in-3.2-webmvc-async]]
=== Support for Servlet 3 based asynchronous request processing
The Spring MVC programming model now provides explicit Servlet 3 async support.
`@RequestMapping` methods can return one of:
* `java.util.concurrent.Callable` to complete processing in a separate thread managed by
a task executor within Spring MVC.
* `org.springframework.web.context.request.async.DeferredResult` to complete processing
at a later time from a thread not known to Spring MVC -- for example, in response to
some external event (JMS, AMQP, etc.)
* `org.springframework.web.context.request.async.AsyncTask` to wrap a `Callable` and
customize the timeout value or the task executor to use.
See <<mvc-ann-async>>.
[[new-in-3.2-spring-mvc-test]]
=== Spring MVC Test framework
First-class support for testing Spring MVC applications with a fluent API and without a
Servlet container. Server-side tests involve use of the `DispatcherServlet` while
client-side REST tests rely on the `RestTemplate`. See <<spring-mvc-test-framework>>.
[[new-in-3.2-webmvc-content-negotiation]]
=== Content negotiation improvements
A `ContentNegotiationStrategy` is now available for resolving the requested media types
from an incoming request. The available implementations are based on the file extension,
query parameter, the 'Accept' header, or a fixed content type. Equivalent options were
previously available only in the ContentNegotiatingViewResolver but are now available
throughout.
`ContentNegotiationManager` is the central class to use when configuring content
negotiation options. For more details see <<mvc-config-content-negotiation>>.
The introduction of `ContentNegotiationManger` also enables selective suffix pattern
matching for incoming requests. For more details, see the Javadoc of
http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework/web/servlet/mvc/method/annotation/RequestMappingHandlerMapping.html#setUseRegisteredSuffixPatternMatch(boolean)[RequestMappingHandlerMapping.setUseRegisteredSuffixPatternMatch].
[[new-in-3.2-matrix-variables]]
=== Matrix variables
A new `@MatrixVariable` annotation adds support for extracting matrix variables from the
request URI. For more details see <<mvc-ann-matrix-variables>>.
[[new-in-3.2-dispatcher-servlet-initializer]]
=== Abstract base class for code-based Servlet 3+ container initialization
An abstract base class implementation of the `WebApplicationInitializer` interface is
provided to simplify code-based registration of a DispatcherServlet and filters mapped
to it. The new class is named `AbstractDispatcherServletInitializer` and its sub-class
`AbstractAnnotationConfigDispatcherServletInitializer` can be used with Java-based
Spring configuration. For more details see <<mvc-container-config>>.
[[new-in-3.2-webmvc-exception-handler-support]]
=== ResponseEntityExceptionHandler class
A convenient base class with an `@ExceptionHandler` method that handles standard Spring
MVC exceptions and returns a `ResponseEntity` that allowing customizing and writing the
response with HTTP message converters. This serves as an alternative to the
`DefaultHandlerExceptionResolver`, which does the same but returns a `ModelAndView`
instead.
See the revised <<mvc-exceptionhandlers>> including information on customizing the
default Servlet container error page.
[[new-in-3.2-webmvc-generic-types-rest-template]]
=== Support for generic types in the RestTemplate and in @RequestBody arguments
The `RestTemplate` can now read an HTTP response to a generic type (e.g.
`List<Account>`). There are three new `exchange()` methods that accept
`ParameterizedTypeReference`, a new class that enables capturing and passing generic
type info.
In support of this feature, the `HttpMessageConverter` is extended by
`GenericHttpMessageConverter` adding a method for reading content given a specified
parameterized type. The new interface is implemented by the
`MappingJacksonHttpMessageConverter` and also by a new
`Jaxb2CollectionHttpMessageConverter` that can read read a generic `Collection` where
the generic type is a JAXB type annotated with `@XmlRootElement` or `@XmlType`.
[[new-in-3.2-webmvc-jackson-json]]
=== Jackson JSON 2 and related improvements
The Jackson JSON 2 library is now supported. Due to packaging changes in the Jackson
library, there are separate classes in Spring MVC as well. Those are
`MappingJackson2HttpMessageConverter` and `MappingJackson2JsonView`. Other related
configuration improvements include support for pretty printing as well as a
`JacksonObjectMapperFactoryBean` for convenient customization of an `ObjectMapper` in
XML configuration.
[[new-in-3.2-webmvc-tiles3]]
=== Tiles 3
Tiles 3 is now supported in addition to Tiles 2.x. Configuring it should be very similar
to the Tiles 2 configuration, i.e. the combination of `TilesConfigurer`,
`TilesViewResolver` and `TilesView` except using the `tiles3` instead of the `tiles2`
package.
Also note that besides the version number change, the tiles dependencies have also
changed. You will need to have a subset or all of `tiles-request-api`, `tiles-api`,
`tiles-core`, `tiles-servlet`, `tiles-jsp`, `tiles-el`.
[[new-in-3.2-webmvc-request-body-arg-with-binding-result]]
=== @RequestBody improvements
An `@RequestBody` or an `@RequestPart` argument can now be followed by an `Errors`
argument making it possible to handle validation errors (as a result of an `@Valid`
annotation) locally within the `@RequestMapping` method. `@RequestBody` now also
supports a required flag.
[[new-in-3.2-webmvc-http-patch]]
=== HTTP PATCH method
The HTTP request method `PATCH` may now be used in `@RequestMapping` methods as well as
in the `RestTemplate` in conjunction with Apache HttpComponents HttpClient version 4.2
or later. The JDK `HttpURLConnection` does not support the `PATCH` method.
[[new-in-3.2-webmvc-mapped-interceptor-exclude-patterns]]
=== Excluded patterns in mapped interceptors
Mapped interceptors now support URL patterns to be excluded. The MVC namespace and the
MVC JavaConfig both expose these options.
[[new-in-3.2-meta-annotations]]
=== Using meta-annotations for injection points and for bean definition methods
As of 3.2, Spring allows for `@Autowired` and `@Value` to be used as meta-annotations,
e.g. to build custom injection annotations in combination with specific qualifiers.
Analogously, you may build custom `@Bean` definition annotations for `@Configuration`
classes, e.g. in combination with specific qualifiers, @Lazy, @Primary, etc.
[[new-in-3.2-jcache]]
=== Initial support for JCache 0.5
Spring provides a CacheManager adapter for JCache, building against the JCache 0.5
preview release. Full JCache support is coming next year, along with Java EE 7 final.
[[new-in-3.2-date-time-format-without-joda]]
=== Support for @DateTimeFormat without Joda Time
The `@DateTimeFormat` annotation can now be used without needing a dependency on the
Joda Time library. If Joda Time is not present the JDK `SimpleDateFormat` will be used
to parse and print date patterns. When Joda Time is present it will continue to be used
in preference to `SimpleDateFormat`.
[[new-in-3.2-global-date-time-format]]
=== Global date & time formatting
It is now possible to define global formats that will be used when parsing and printing
date and time types. See <<format-configuring-formatting-globaldatetimeformat>> for
details.
[[new-in-3.2-testing]]
=== New Testing Features
In addition to the aforementioned inclusion of the <<spring-mvc-test-framework,Spring
MVC Test Framework>> in the `spring-test` module, the __Spring TestContext Framework__
has been revised with support for integration testing web applications as well as
configuring application contexts with context initializers. For further details, consult
the following.
* Configuring and <<testcontext-ctx-management-web,loading a WebApplicationContext>> in
integration tests
* Configuring <<testcontext-ctx-management-ctx-hierarchies,context hierarchies>> in
integration tests
* Testing <<testcontext-web-scoped-beans,request and session scoped beans>>
* Improvements to <<mock-objects-servlet,Servlet API mocks>>
* Configuring test application contexts with
<<testcontext-ctx-management-initializers,ApplicationContextInitializers>>
[[new-in-3.2-concurrency]]
=== Concurrency refinements across the framework
Spring Framework 3.2 includes fine-tuning of concurrent data structures in many parts of
the framework, minimizing locks and generally improving the arrangements for highly
concurrent creation of scoped/prototype beans.
[[new-in-3.2-build]]
=== New Gradle-based build and move to GitHub
Building and contributing to the framework has never been simpler with our move to a
Gradle-based build system and source control at GitHub. See the
https://github.com/SpringSource/spring-framework#building-from-source[building from
source] section of the README and the
https://github.com/SpringSource/spring-framework/blob/master/CONTRIBUTING.md[contributor
guidelines] for complete details.
[[new-in-3.2-java7]]
=== Refined Java SE 7 / OpenJDK 7 support
Last but not least, Spring Framework 3.2 comes with refined Java 7 support within the
framework as well as through upgraded third-party dependencies: specifically, CGLIB 3.0,
ASM 4.0 (both of which come as inlined dependencies with Spring now) and AspectJ 1.7
support (next to the existing AspectJ 1.6 support).
[[spring-core]]
= Core Technologies
[partintro]