Polish reference manual

This commit is contained in:
Sam Brannen
2013-12-13 15:35:38 +01:00
parent 569fbc9f39
commit f199d5187b

View File

@@ -804,17 +804,17 @@ retained for the time being where Spring 3.2 had it; now just in deprecated form
=== Java 8 (as well as 6 and 7) === Java 8 (as well as 6 and 7)
Spring Framework 4.0 provides support for several Java 8 features. You can make use of Spring Framework 4.0 provides support for several Java 8 features. You can make use of
__lambda expressions__ and __method references__ with Spring's callback interfaces. There __lambda expressions__ and __method references__ with Spring's callback interfaces. There
is first class support for `java.time` (http://jcp.org/en/jsr/detail?id=310[JSR-310]) and is first class support for `java.time` (http://jcp.org/en/jsr/detail?id=310[JSR-310]), and
several existing annotations have been retrofitted as `@Repeatable`. You can also use several existing annotations have been retrofitted as `@Repeatable`. You can also use
Java 8's parameter name discovery as an alternative to compiling your code with debug Java 8's parameter name discovery as an alternative to compiling your code with debug
information enabled. information enabled.
Spring remains compatible with older versions of Java and the JDK: Concretely, Java SE 6 Spring remains compatible with older versions of Java and the JDK: concretely, Java SE 6
(specifically, a minimum level equivalent to JDK 6 update 10, as released in late 2008) (specifically, a minimum level equivalent to JDK 6 update 10, as released in late 2008)
and above are still fully supported. However, for newly started development projects and above are still fully supported. However, for newly started development projects
based on Spring 4, we recommend the use of Java 7 or 8. based on Spring 4, we recommend the use of Java 7 or 8.
Note that the Java 8 bytecode level (-target 1.8, as required by -source 1.8) is only Note that the Java 8 bytecode level (`-target 1.8`, as required by `-source 1.8`) is only
fully supported as of Spring Framework 4.0. In particular, Spring 3.2 based applications fully supported as of Spring Framework 4.0. In particular, Spring 3.2 based applications
need to be compiled with a maximum of Java 7 as the target, even if they happen to be need to be compiled with a maximum of Java 7 as the target, even if they happen to be
deployed onto a Java 8 runtime. Please upgrade to Spring 4 for Java 8 based applications. deployed onto a Java 8 runtime. Please upgrade to Spring 4 for Java 8 based applications.
@@ -831,7 +831,7 @@ is recommended when at all possible.
[NOTE] [NOTE]
==== ====
If you are a WebSphere 7 user, be sure install the JPA 2.0 feature pack. On If you are a WebSphere 7 user, be sure to install the JPA 2.0 feature pack. On
WebLogic 10.3.4 or higher, install the JPA 2.0 patch that comes with it. This turns WebLogic 10.3.4 or higher, install the JPA 2.0 patch that comes with it. This turns
both of those server generations into Spring 4 compatible deployment environments. both of those server generations into Spring 4 compatible deployment environments.
==== ====
@@ -840,7 +840,7 @@ On a more forward-looking note, Spring Framework 4.0 supports the Java EE 7 leve
applicable specifications now: in particular, JMS 2.0, JTA 1.2, JPA 2.1, Bean Validation applicable specifications now: in particular, JMS 2.0, JTA 1.2, JPA 2.1, Bean Validation
1.1, and JSR-236 Concurrency Utilities. As usual, this support focuses on individual 1.1, and JSR-236 Concurrency Utilities. As usual, this support focuses on individual
use of those specifications, e.g. on Tomcat or in standalone environments. However, use of those specifications, e.g. on Tomcat or in standalone environments. However,
it works equally well when a Spring application is being deployed to a Java EE 7 server. it works equally well when a Spring application is deployed to a Java EE 7 server.
Note that Hibernate 4.3 is a JPA 2.1 provider and therefore only supported as of Note that Hibernate 4.3 is a JPA 2.1 provider and therefore only supported as of
Spring Framework 4.0. The same applies to Hibernate Validator 5.0 as a Bean Validation Spring Framework 4.0. The same applies to Hibernate Validator 5.0 as a Bean Validation
@@ -893,16 +893,16 @@ There have been several general improvements to the core container:
`@Autowired Repository<Customer> customerRepository`. `@Autowired Repository<Customer> customerRepository`.
* If you use Spring's meta-annotation support, you can now develop custom annotations that * If you use Spring's meta-annotation support, you can now develop custom annotations that
<<beans-meta-annotations,expose specific attributes from the source annotation>>. <<beans-meta-annotations,expose specific attributes from the source annotation>>.
* Beans can now be `Ordered` when they are <<beans-autowired-annotation,autowired into * Beans can now be __ordered__ when they are <<beans-autowired-annotation,autowired into
lists and arrays>>. Both the `@Ordered` annotation and `Ordered` interface are lists and arrays>>. Both the `@Ordered` annotation and `Ordered` interface are
supported. supported.
* The `@Lazy` annotation can now be used on injection points, as well as `@Bean` * The `@Lazy` annotation can now be used on injection points, as well as on `@Bean`
definitions. definitions.
* The <<beans-java-bean-description,`@Description` annotation has been added>> for * The <<beans-java-bean-description,`@Description` annotation has been introduced>> for
developers using Java-based configuration. developers using Java-based configuration.
* A generalized model for <<beans-java-conditional,conditionally filtering beans>> has * A generalized model for <<beans-java-conditional,conditionally filtering beans>> has
been added via the `@Conditional` annotation. This is similar to `@Profile` but allows been added via the `@Conditional` annotation. This is similar to `@Profile` support but
for user-defined strategies to be developed. allows for user-defined strategies to be developed programmatically.
* <<aop-pfb-proxy-types,CGLIB-based proxy classes>> no longer require a default * <<aop-pfb-proxy-types,CGLIB-based proxy classes>> no longer require a default
constructor. Support is provided via the http://code.google.com/p/objenesis/[objenesis] constructor. Support is provided via the http://code.google.com/p/objenesis/[objenesis]
library which is repackaged __inline__ and distributed as part of the Spring Framework. library which is repackaged __inline__ and distributed as part of the Spring Framework.
@@ -918,10 +918,10 @@ focused primarily on Servlet 3.0+ environments. If you are using the
<<spring-mvc-test-framework,Spring MVC Test Framework>> you <<spring-mvc-test-framework,Spring MVC Test Framework>> you
will need to ensure that a Servlet 3.0 compatible JAR is in your __test classpath__. will need to ensure that a Servlet 3.0 compatible JAR is in your __test classpath__.
In addition to the WebSocket support mentioned earlier, the following general improvements In addition to the WebSocket support mentioned later, the following general improvements
have been made to Spring's Web modules: have been made to Spring's Web modules:
* You can use <<mvc-ann-restcontroller,the new `@RestController` annotation>> with Spring * You can use the <<mvc-ann-restcontroller,new `@RestController` annotation>> with Spring
MVC applications, removing the need to add `@ResponseBody` to each of your MVC applications, removing the need to add `@ResponseBody` to each of your
`@RequestMapping` methods. `@RequestMapping` methods.
* The `AsyncRestTemplate` class has been added, <<rest-async-resttemplate,allowing * The `AsyncRestTemplate` class has been added, <<rest-async-resttemplate,allowing
@@ -937,7 +937,7 @@ A new `spring-websocket` module provides comprehensive support for WebSocket-bas
two-way communication between client and server in web applications. It is compatible with two-way communication between client and server in web applications. It is compatible with
http://jcp.org/en/jsr/detail?id=356[JSR-356], the Java WebSocket API, and in addition http://jcp.org/en/jsr/detail?id=356[JSR-356], the Java WebSocket API, and in addition
provides SockJS-based fallback options (i.e. WebSocket emulation) for use in browsers provides SockJS-based fallback options (i.e. WebSocket emulation) for use in browsers
that don't yet support the WebSocket protocol (e.g. IE < 10). that don't yet support the WebSocket protocol (e.g. Internet Explorer < 10).
A new `spring-messaging` module adds support for STOMP as the WebSocket sub-protocol A new `spring-messaging` module adds support for STOMP as the WebSocket sub-protocol
to use in applications along with an annotation programming model for routing and to use in applications along with an annotation programming model for routing and
@@ -946,10 +946,10 @@ can now contain both `@RequestMapping` and `@MessageMapping` methods for handlin
HTTP requests and messages from WebSocket-connected clients. The new `spring-messaging` HTTP requests and messages from WebSocket-connected clients. The new `spring-messaging`
module also contains key abstractions from the module also contains key abstractions from the
http://projects.spring.io/spring-integration/[Spring Integration] project such as http://projects.spring.io/spring-integration/[Spring Integration] project such as
`Message`, `MessageChannel`, `MessageHandler` and others to serve as `Message`, `MessageChannel`, `MessageHandler`, and others to serve as a foundation
a foundation for messaging applications. for messaging-based applications.
For more details including a more thorough introduction, see the <<websocket>> section. For further details, including a more thorough introduction, see the <<websocket>> section.
@@ -961,17 +961,17 @@ Framework 4.0 introduces several new features for use in unit and integration te
* Almost all annotations in the `spring-test` module (e.g., `@ContextConfiguration`, * Almost all annotations in the `spring-test` module (e.g., `@ContextConfiguration`,
`@WebAppConfiguration`, `@ContextHierarchy`, `@ActiveProfiles`, etc.) can now be used `@WebAppConfiguration`, `@ContextHierarchy`, `@ActiveProfiles`, etc.) can now be used
as <<integration-testing-annotations-meta,meta-annotations>> to create custom as <<integration-testing-annotations-meta,meta-annotations>> to create custom
_composed annotations_ and reduce configuration duplication across tests. _composed annotations_ and reduce configuration duplication across a test suite.
* Active bean definition profiles can now be resolved programmatically, simply by * Active bean definition profiles can now be resolved programmatically, simply by
implementing a custom <<testcontext-ctx-management-env-profiles-ActiveProfilesResolver,`ActiveProfilesResolver`>> implementing a custom <<testcontext-ctx-management-env-profiles-ActiveProfilesResolver,`ActiveProfilesResolver`>>
and registering it via the `resolver` attribute of `@ActiveProfiles`. and registering it via the `resolver` attribute of `@ActiveProfiles`.
* A new `SocketUtils` utility class has been introduced in the `spring-core` module * A new `SocketUtils` class has been introduced in the `spring-core` module
which enables you to scan for free TCP & UDP server ports on localhost. This which enables you to scan for free TCP and UDP server ports on localhost. This
functionality is not specific to testing but can prove very useful when writing functionality is not specific to testing but can prove very useful when writing
integration tests that require the use of sockets, for example tests that start integration tests that require the use of sockets, for example tests that start
an in-memory SMTP server, FTP server, Servlet container, etc. an in-memory SMTP server, FTP server, Servlet container, etc.
* As of Spring 4.0, the set of mocks in the `org.springframework.mock.web` package is * As of Spring 4.0, the set of mocks in the `org.springframework.mock.web` package is
now compatible with Servlet 3.0. Furthermore, several of the Servlet API mocks now based on the Servlet 3.0 API. Furthermore, several of the Servlet API mocks
(e.g., `MockHttpServletRequest`, `MockServletContext`, etc.) have been updated with (e.g., `MockHttpServletRequest`, `MockServletContext`, etc.) have been updated with
minor enhancements and improved configurability. minor enhancements and improved configurability.
@@ -1414,15 +1414,16 @@ Every bean has one or more identifiers. These identifiers must be unique within
container that hosts the bean. A bean usually has only one identifier, but if it container that hosts the bean. A bean usually has only one identifier, but if it
requires more than one, the extra ones can be considered aliases. requires more than one, the extra ones can be considered aliases.
In XML-based configuration metadata, you use the `id` and/or `name` attributes to In XML-based configuration metadata, you use the `id` and/or `name` attributes
specify the bean identifier(s). The `id` attribute allows you to specify exactly one id. to specify the bean identifier(s). The `id` attribute allows you to specify
Conventionally these names are alphanumeric ('myBean', 'fooService', etc), but may exactly one id. Conventionally these names are alphanumeric ('myBean',
special characters as well. If you want to introduce other aliases to the bean, you can 'fooService', etc.), but may contain special characters as well. If you want to
also specify them in the `name` attribute, separated by a comma (`,`), semicolon (`;`), introduce other aliases to the bean, you can also specify them in the `name`
or white space. As a historical note, in versions prior to Spring 3.1, the `id` attribute, separated by a comma (`,`), semicolon (`;`), or white space. As a
attribute was typed as an `xsd:ID`, which constrained possible characters. As of 3.1, historical note, in versions prior to Spring 3.1, the `id` attribute was
it is now `xsd:string`. Note that bean id uniqueness is still enforced by the defined as an `xsd:ID` type, which constrained possible characters. As of 3.1,
container, though no longer by XML parsers. it is defined as an `xsd:string` type. Note that bean `id` uniqueness is still
enforced by the container, though no longer by XML parsers.
You are not required to supply a name or id for a bean. If no name or id is supplied You are not required to supply a name or id for a bean. If no name or id is supplied
explicitly, the container generates a unique name for that bean. However, if you want to explicitly, the container generates a unique name for that bean. However, if you want to
@@ -1465,8 +1466,8 @@ XML-based configuration metadata, you can use the `<alias/>` element to accompli
<alias name="fromName" alias="toName"/> <alias name="fromName" alias="toName"/>
---- ----
In this case, a bean in the same container which is named `fromName`, may also after the In this case, a bean in the same container which is named `fromName`, may also,
use of this alias definition, be referred to as `toName`. after the use of this alias definition, be referred to as `toName`.
For example, the configuration metadata for subsystem A may refer to a DataSource via For example, the configuration metadata for subsystem A may refer to a DataSource via
the name `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to the name `subsystemA-dataSource`. The configuration metadata for subsystem B may refer to
@@ -18413,7 +18414,7 @@ well as any __set up__ or __tear down__ of the test fixture.
===== Meta-Annotation Support for Testing ===== Meta-Annotation Support for Testing
As of Spring Framework 4.0, it is now possible to use test-related annotations As of Spring Framework 4.0, it is now possible to use test-related annotations
as <<beans-meta-annotations,meta-annotations>> in order to create custom as <<beans-meta-annotations,meta-annotations>> in order to create custom
_composed annotations_ and reduce configuration duplication across tests. _composed annotations_ and reduce configuration duplication across a test suite.
Each of the following may be used as meta-annotations in conjunction with the Each of the following may be used as meta-annotations in conjunction with the
<<testcontext-framework,TestContext framework>>. <<testcontext-framework,TestContext framework>>.