提交 a61d1076 编写于 作者: J Juergen Hoeller

Asciidoc revision (chapter declarations, javadoc references, etc)

上级 67bd3f67
[[aop-api]]
= Spring AOP APIs
The previous chapter described the Spring's support for AOP with
@AspectJ and schema-based aspect definitions. In this chapter, we discuss the lower-level
Spring AOP APIs and the AOP support typically used in Spring 1.2 applications. For new
......@@ -14,6 +12,7 @@ in Spring 5.
[[aop-api-pointcuts]]
== Pointcut API in Spring
......@@ -129,7 +128,6 @@ Spring provides several convenient pointcut implementations. You can use some of
Others are intended to be subclassed in application-specific pointcuts.
[[aop-api-pointcuts-static]]
==== Static Pointcuts
......@@ -198,8 +196,6 @@ pointcut and advice, as the following example shows:
You can use `RegexpMethodPointcutAdvisor` with any `Advice` type.
[[aop-api-pointcuts-attribute-driven]]
===== Attribute-driven Pointcuts
......@@ -207,7 +203,6 @@ An important type of static pointcut is a metadata-driven pointcut. This uses th
values of metadata attributes (typically, source-level metadata).
[[aop-api-pointcuts-dynamic]]
==== Dynamic pointcuts
......@@ -276,6 +271,7 @@ for example, "`all methods that change instance variables in the target object.`
[[aop-api-advice]]
== Advice API in Spring
......@@ -366,7 +362,6 @@ are not currently interoperable between frameworks, and the AOP Alliance does no
currently define pointcut interfaces.
[[aop-api-advice-before]]
==== Before Advice
......@@ -425,7 +420,6 @@ The following example shows a before advice in Spring, which counts all method i
TIP: Before advice can be used with any pointcut.
[[aop-api-advice-throws]]
==== Throws Advice
......@@ -511,7 +505,6 @@ exception that is incompatible with the target method's signature!_
TIP: Throws advice can be used with any pointcut.
[[aop-api-advice-after-returning]]
==== After Returning Advice
......@@ -562,7 +555,6 @@ thrown up the interceptor chain instead of the return value.
TIP: After returning advice can be used with any pointcut.
[[aop-api-advice-introduction]]
==== Introduction Advice
......@@ -738,6 +730,8 @@ and stateful mixins.
[[aop-api-advisor]]
== The Advisor API in Spring
......@@ -756,6 +750,7 @@ chain.
[[aop-pfb]]
== Using the `ProxyFactoryBean` to Create AOP Proxies
......@@ -1085,6 +1080,7 @@ two global advisors:
[[aop-concise-proxy]]
== Concise Proxy Definitions
......@@ -1164,6 +1160,7 @@ pre-instantiate it.
[[aop-prog]]
== Creating AOP Proxies Programmatically with the `ProxyFactory`
......@@ -1205,6 +1202,7 @@ as you should in general.
[[aop-api-advised]]
== Manipulating Advised Objects
......@@ -1298,6 +1296,7 @@ required.
[[aop-autoproxy]]
== Using the "auto-proxy" facility
......@@ -1327,7 +1326,6 @@ This section covers the auto-proxy creators provided by the
`org.springframework.aop.framework.autoproxy` package.
[[aop-api-autoproxy]]
==== `BeanNameAutoProxyCreator`
......@@ -1435,6 +1433,7 @@ preceding example has a configurable order value. The default setting is unorder
[[aop-targetsource]]
== Using `TargetSource` Implementations
......@@ -1552,7 +1551,7 @@ The following listig shows an example configuration:
Note that the target object (`businessObjectTarget` in the preceding example) must be a
prototype. This lets the `PoolingTargetSource` implementation create new instances
of the target to grow the pool as necessary. See the {api-spring-framework}aop/target/AbstractPoolingTargetSource.html[Javadoc of
of the target to grow the pool as necessary. See the {api-spring-framework}aop/target/AbstractPoolingTargetSource.html[javadoc of
`AbstractPoolingTargetSource`] and the concrete subclass you wish to use for information
about its properties. `maxSize` is the most basic and is always guaranteed to be present.
......@@ -1661,6 +1660,7 @@ any case, since not unsetting it might result in problematic behavior. Spring's
[[aop-extensibility]]
== Defining New Advice Types
......@@ -1674,5 +1674,5 @@ support for new custom advice types be added without changing the core framework
The only constraint on a custom `Advice` type is that it must implement the
`org.aopalliance.aop.Advice` marker interface.
See the {api-spring-framework}/aop/framework/adapter/package-frame.html[`org.springframework.aop.framework.adapter` Javadoc] for further
information.
See the {api-spring-framework}/aop/framework/adapter/package-frame.html[`org.springframework.aop.framework.adapter`]
javadoc for further information.
......@@ -37,6 +37,7 @@ Spring AOP, and can skip most of this chapter.
[[aop-introduction-defn]]
== AOP Concepts
......@@ -115,6 +116,7 @@ multiple objects (such as all business operations in the service layer).
[[aop-introduction-spring-defn]]
== Spring AOP Capabilities and Goals
......@@ -175,6 +177,7 @@ style.
[[aop-introduction-proxies]]
== AOP Proxies
......@@ -195,6 +198,7 @@ implementation detail actually means.
[[aop-ataspectj]]
== @AspectJ support
......@@ -244,7 +248,6 @@ annotation, as the following example shows:
====
[[aop-enable-aspectj-xml]]
==== Enabling @AspectJ Support with XML Configuration
......@@ -458,7 +461,6 @@ it is natural and straightforward to identify specific beans by name.
====
[[aop-pointcuts-combining]]
==== Combining Pointcut Expressions
......@@ -486,8 +488,6 @@ of any public method.
trading module.
====
It is a best practice to build more complex pointcut expressions out of smaller named
components, as shown earlier. When referring to pointcuts by name, normal Java visibility
rules apply (you can see private pointcuts in the same type, protected pointcuts in the
......@@ -824,7 +824,6 @@ match the wildcard expression `*Service`:
====
[[writing-good-pointcuts]]
==== Writing Good Pointcuts
......@@ -918,7 +917,6 @@ following example:
====
[[aop-advice-after-returning]]
==== After Returning Advice
......@@ -983,7 +981,6 @@ Please note that it is not possible to return a totally different reference when
using after returning advice.
[[aop-advice-after-throwing]]
==== After Throwing Advice
......@@ -1072,7 +1069,6 @@ The following example shows how to use after finally advice:
====
[[aop-ataspectj-around-advice]]
==== Around Advice
......@@ -1136,7 +1132,6 @@ many times, or not at all within the body of the around advice. All of these are
legal.
[[aop-ataspectj-advice-params]]
==== Advice Parameters
......@@ -1161,7 +1156,7 @@ a first parameter of type `ProceedingJoinPoint`, which is a subclass of `JoinPoi
* `getSignature()`: Returns a description of the method that is being advised.
* `toString()`: Prints a useful description of the method being advised.
See the https://www.eclipse.org/aspectj/doc/released/runtime-api/org/aspectj/lang/JoinPoint.html[Javadoc] for more detail.
See the https://www.eclipse.org/aspectj/doc/released/runtime-api/org/aspectj/lang/JoinPoint.html[javadoc] for more detail.
[[aop-ataspectj-advice-params-passing]]
===== Passing Parameters to Advice
......@@ -1646,6 +1641,7 @@ expression so that only `@Idempotent` operations match, as follows:
[[aop-schema]]
== Schema-based AOP Support
......@@ -1846,7 +1842,6 @@ The schema-based AOP support uses the same five kinds of advice as the @AspectJ
exactly the same semantics.
[[aop-schema-advice-before]]
==== Before Advice
......@@ -1899,7 +1894,6 @@ join point matched by the pointcut expression), the `doAccessCheck` method on th
bean is invoked.
[[aop-schema-advice-after-returning]]
==== After Returning Advice
......@@ -1957,7 +1951,6 @@ example, you can decleare the method signature as follows:
====
[[aop-schema-advice-after-throwing]]
==== After Throwing Advice
......@@ -2015,7 +2008,6 @@ example, the method signature may be declared as follows:
====
[[aop-schema-advice-after-finally]]
==== After (Finally) Advice
......@@ -2039,7 +2031,6 @@ by using the `after` element, as the following example shows:
====
[[aop-schema-advice-around]]
==== Around Advice
......@@ -2092,7 +2083,6 @@ The implementation of the `doBasicProfiling` advice can be exactly the same as i
====
[[aop-schema-params]]
==== Advice Parameters
......@@ -2244,7 +2234,6 @@ ms % Task name
====
[[aop-ordering]]
==== Advice Ordering
......@@ -2502,6 +2491,7 @@ pointcut expression so that only `@Idempotent` operations match, as follows:
[[aop-choosing]]
== Choosing which AOP Declaration Style to Use
......@@ -2613,6 +2603,7 @@ co-exist without any difficulty.
[[aop-proxying]]
== Proxying Mechanisms
......@@ -2823,6 +2814,7 @@ it is not a proxy-based AOP framework.
[[aop-aspectj-programmatic]]
== Programmatic Creation of @AspectJ Proxies
......@@ -2855,7 +2847,8 @@ The basic usage for this class is very simple, as the following example shows:
----
====
See the {api-spring-framework}/aop/aspectj/annotation/AspectJProxyFactory.html[Javadoc] for more information.
See the {api-spring-framework}/aop/aspectj/annotation/AspectJProxyFactory.html[javadoc] for more information.
......@@ -3058,7 +3051,6 @@ with the container. Doing so results in double initialization, once through the
container and once through the aspect.
[[aop-configurable-testing]]
==== Unit Testing `@Configurable` Objects
......@@ -3072,7 +3064,6 @@ see a warning message each time that you construct an `@Configurable` object ind
that it has not been configured by Spring.
[[aop-configurable-container]]
==== Working with Multiple Application Contexts
......@@ -3474,7 +3465,6 @@ and then easily exclude from builds of the application being deployed
into UAT or production.
[[aop-aj-ltw-the-aspects]]
==== Aspects
......@@ -3484,7 +3474,6 @@ Your aspects are then both valid AspectJ and Spring AOP aspects.
Furthermore, the compiled aspect classes need to be available on the classpath.
[[aop-aj-ltw-aop_dot_xml]]
==== 'META-INF/aop.xml'
......@@ -3520,10 +3509,10 @@ adding one or more `java.lang.instrument.ClassFileTransformers` to a `ClassLoade
runtime, which opens the door to all manner of interesting applications, one of which
happens to be the LTW of aspects.
TIP: If you are unfamiliar with the idea of runtime class file transformation, se
the Javadoc API documentation for the `java.lang.instrument` package
before continuing. While that documentation is not comprehensive, at least you can see the
key interfaces and classes (for reference as you read through this section).
TIP: If you are unfamiliar with the idea of runtime class file transformation, see the
javadoc API documentation for the `java.lang.instrument` package before continuing.
While that documentation is not comprehensive, at least you can see the key interfaces
and classes (for reference as you read through this section).
Configuring a `LoadTimeWeaver` for a particular `ApplicationContext` can be as easy as
adding one line. (Note that you almost certainly need to use an
......@@ -3660,7 +3649,7 @@ retrieved from the Spring container by using the well known name, `loadTimeWeave
Remember that the `LoadTimeWeaver` exists only as a mechanism for Spring's LTW
infrastructure to add one or more `ClassFileTransformers`. The actual
`ClassFileTransformer` that does the LTW is the `ClassPreProcessorAgentAdapter` (from
the `org.aspectj.weaver.loadtime` package) class. See the class-level Javadoc of the
the `org.aspectj.weaver.loadtime` package) class. See the class-level javadoc of the
`ClassPreProcessorAgentAdapter` class for further details, because the specifics of how
the weaving is actually effected is beyond the scope of this document.
......@@ -3774,8 +3763,6 @@ to your artifact a file named `WEB-INF/jboss-scanning.xml` with the following co
----
====
[[aop-aj-ltw-environment-generic]]
===== Generic Java Applications
......@@ -3806,11 +3793,11 @@ support) a dedicated LTW.
[[aop-resources]]
== Further Resources
More information on AspectJ can be found on the http://www.eclipse.org/aspectj[AspectJ
website].
More information on AspectJ can be found on the http://www.eclipse.org/aspectj[AspectJ website].
_Eclipse AspectJ_ by Adrian Colyer et. al. (Addison-Wesley, 2005) provides a
comprehensive introduction and reference for the AspectJ language.
......
......@@ -30,8 +30,9 @@ correct schema so that the tags in the `util` namespace are available to you):
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:util="http://www.springframework.org/schema/util"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd"__>
<!-- bean definitions here -->
</beans>
----
====
......@@ -322,7 +323,7 @@ bean, there is no need to refer to it at all, as the following example shows:
====
You can specifically set the result type in the actual definition. This is not necessary
for most use cases, but it can sometimes be useful. See the Javadoc for more info on
for most use cases, but it can sometimes be useful. See the javadoc for more info on
this feature.
......@@ -576,8 +577,9 @@ are available to you):
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:aop="http://www.springframework.org/schema/aop"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"__>
<!-- bean definitions here -->
</beans>
----
====
......@@ -602,8 +604,9 @@ available to you:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:context="http://www.springframework.org/schema/context"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"__>
<!-- bean definitions here -->
</beans>
----
====
......
......@@ -5,6 +5,7 @@ This chapter covers Spring's Inversion of Control (IoC) container.
[[beans-introduction]]
== Introduction to the Spring IoC Container and Beans
......@@ -3072,7 +3073,7 @@ To integrate your custom scopes into the Spring container, you need to implement
`org.springframework.beans.factory.config.Scope` interface, which is described in this
section. For an idea of how to implement your own scopes, see the `Scope`
implementations that are supplied with the Spring Framework itself and the
{api-spring-framework}/beans/factory/config/Scope.html[`Scope` Javadoc],
{api-spring-framework}/beans/factory/config/Scope.html[`Scope`] javadoc,
which explains the methods you need to implement in more detail.
The `Scope` interface has four methods to get objects from the scope, remove them from
......@@ -3115,7 +3116,7 @@ destroyed or when the specified object in the scope is destroyed:
----
====
See the {api-spring-framework}/beans/factory/config/Scope.html#registerDestructionCallback[Javadoc]
See the {api-spring-framework}/beans/factory/config/Scope.html#registerDestructionCallback[javadoc]
or a Spring scope implementation for more information on destruction callbacks.
The following method obtains the conversation identifier for the underlying scope:
......@@ -3963,12 +3964,13 @@ after the Spring container finishes instantiating, configuring, and initializing
you can plug in one or more `BeanPostProcessor` implementations.
You can configure multiple `BeanPostProcessor` instances, and you can control the order
in which these `BeanPostProcessor` instances execute by setting the `order` property. You can
set this property only if the `BeanPostProcessor` implements the `Ordered` interface. If
you write your own `BeanPostProcessor`, you should consider implementing the `Ordered`
interface, too. For further details, see the Javadoc of the {api-spring-framework}/beans/factory/config/BeanPostProcessor.html[`BeanPostProcessor`] and
{api-spring-framework}/core/Ordered.html[`Ordered`] interfaces. See also the note on
<<beans-factory-programmatically-registering-beanpostprocessors, programmatic
in which these `BeanPostProcessor` instances execute by setting the `order` property.
You can set this property only if the `BeanPostProcessor` implements the `Ordered`
interface. If you write your own `BeanPostProcessor`, you should consider implementing
the `Ordered` interface, too. For further details, see the javadoc of the
{api-spring-framework}/beans/factory/config/BeanPostProcessor.html[`BeanPostProcessor`]
and {api-spring-framework}/core/Ordered.html[`Ordered`] interfaces. See also the note
on <<beans-factory-programmatically-registering-beanpostprocessors, programmatic
registration of `BeanPostProcessor` instances>>.
[NOTE]
......@@ -4184,7 +4186,7 @@ You can configure multiple `BeanFactoryPostProcessor` instances, and you can con
which these `BeanFactoryPostProcessor` instances run by setting the `order` property.
However, you can only set this property if the `BeanFactoryPostProcessor` implements the
`Ordered` interface. If you write your own `BeanFactoryPostProcessor`, you should
consider implementing the `Ordered` interface, too. See the Javadoc of the
consider implementing the `Ordered` interface, too. See the javadoc of the
{api-spring-framework}/beans/factory/config/BeanFactoryPostProcessor.html[`BeanFactoryPostProcessor`] and {api-spring-framework}/core/Ordered.html[`Ordered`] interfaces for more details.
[NOTE]
......@@ -4302,7 +4304,7 @@ the following three supported integer values:
* `override` (2): Check system properties first, before trying the specified
properties files. This lets system properties override any other property source.
See the {api-spring-framework}/beans/factory/config/PropertyPlaceholderConfigurer.html[`PropertyPlaceholderConfigurer`] Javadoc for more information.
See the {api-spring-framework}/beans/factory/config/PropertyPlaceholderConfigurer.html[`PropertyPlaceholderConfigurer`] javadoc for more information.
[TIP]
=====
......@@ -7778,8 +7780,8 @@ method that returns `true` or `false`. For example, the following listing shows
----
====
See the {api-spring-framework}/context/annotation/Conditional.html[
`@Conditional` Javadoc] for more detail.
See the {api-spring-framework}/context/annotation/Conditional.html[`@Conditional`]
javadoc for more detail.
[[beans-java-combining]]
......@@ -8617,8 +8619,8 @@ may implement `LoadTimeWeaverAware`, thereby receiving a reference to the load-t
weaver instance. This is particularly useful in combination with
<<data-access.adoc#orm-jpa,Spring's JPA support>> where load-time weaving may be necessary
for JPA class transformation.
Consult the {api-spring-framework}/orm/jpa/LocalContainerEntityManagerFactoryBean.html[`LocalContainerEntityManagerFactoryBean` javadoc]
for more detail. For more on AspectJ load-time weaving, see <<aop-aj-ltw>>.
Consult the {api-spring-framework}/orm/jpa/LocalContainerEntityManagerFactoryBean.html[`LocalContainerEntityManagerFactoryBean`]
javadoc for more detail. For more on AspectJ load-time weaving, see <<aop-aj-ltw>>.
......@@ -8863,8 +8865,8 @@ file format but is more flexible than the standard JDK based
`ResourceBundleMessageSource` implementation. In particular, it allows for reading
files from any Spring resource location (not only from the classpath) and supports hot
reloading of bundle property files (while efficiently caching them in between).
See the {api-spring-framework}/context/support/ReloadableResourceBundleMessageSource.html[`ReloadableResourceBundleMessageSource` javadoc]
for details.
See the {api-spring-framework}/context/support/ReloadableResourceBundleMessageSource.html[`ReloadableResourceBundleMessageSource`]
javadoc for details.
......
......@@ -9,6 +9,7 @@ platforms (that is, Servlet 3.1+).
== `DataBufferFactory`
The `DataBufferFactory` offers functionality to allocate new data buffers as well as to wrap
......@@ -21,9 +22,9 @@ Wrapping does not involve allocation. It decorates the given data with a `DataBu
implementation.
There are two implementation of `DataBufferFactory`: the `NettyDataBufferFactory`
(for Netty platforms, such as Reactor Netty) and
`DefaultDataBufferFactory` (for other platforms, such as
Servlet 3.1+ servers).
(for Netty platforms, such as Reactor Netty) and `DefaultDataBufferFactory`
(for other platforms, such as Servlet 3.1+ servers).
......@@ -153,6 +154,7 @@ streaming solution would.
[[codecs]]
== Codecs
......
......@@ -54,6 +54,7 @@ The expression language supports the following functionality:
[[expressions-evaluation]]
== Evaluation
......@@ -322,19 +323,18 @@ someArray[0].someProperty.someOtherProperty < 0.1
----
====
Because the preceding expression involves array access, some property de-referencing, and numeric operations, the performance
gain can be very noticeable. In an example micro benchmark run of 50000 iterations, it
took 75ms to evaluate by using the interpreter and only 3ms using the compiled version
of the expression.
Because the preceding expression involves array access, some property de-referencing,
and numeric operations, the performance gain can be very noticeable. In an example
micro benchmark run of 50000 iterations, it took 75ms to evaluate by using the
interpreter and only 3ms using the compiled version of the expression.
[[expressions-compiler-configuration]]
==== Compiler Configuration
The compiler is not turned on by default, but you can turn it on in either of two different
ways. You can turn it on by using the parser configuration process (<<expressions-parser-configuration,discussed earlier>>) or
by using a system property when SpEL usage is embedded inside another component. This section
The compiler is not turned on by default, but you can turn it on in either of two different ways.
You can turn it on by using the parser configuration process (<<expressions-parser-configuration,discussed earlier>>)
or by using a system property when SpEL usage is embedded inside another component. This section
discusses both of these options.
The compiler can operate in one of three modes, which are captured
......@@ -409,6 +409,7 @@ More types of expression will be compilable in the future.
[[expressions-beandef]]
== Expressions in Bean Definitions
......@@ -574,6 +575,7 @@ examples show:
[[expressions-language-ref]]
== Language Reference
......@@ -596,6 +598,8 @@ topics:
* <<expressions-operator-elvis>>
* <<expressions-operator-safe-navigation>>
[[expressions-ref-literal]]
=== Literal Expressions
......@@ -886,7 +890,6 @@ which the expression is embedded (such as in an XML document). The textual equiv
All of the textual operators are case-insensitive.
[[expressions-operators-logical]]
==== Logical Operators
......@@ -932,7 +935,6 @@ The following example shows how to use the logical operators
====
[[expressions-operators-mathematical]]
==== Mathematical Operators
......@@ -977,7 +979,6 @@ following example shows the mathematical operators in use:
====
[[expressions-assignment]]
==== The Assignment Operator
......@@ -1075,7 +1076,6 @@ following example shows how to use variables:
====
[[expressions-this-root]]
==== The `#this` and `#root` Variables
......@@ -1457,6 +1457,7 @@ The definition of `TemplateParserContext` follows:
[[expressions-example-classes]]
== Classes Used in the Examples
......
......@@ -27,6 +27,7 @@ NOTE: Libraries like Reactor or Spring Data provide null-safe APIs that use this
== Use cases
In addition to providing an explicit declaration for Spring Framework API nullability,
......@@ -38,6 +39,9 @@ They are also used to make Spring API null-safe in Kotlin projects, since Kotlin
supports https://kotlinlang.org/docs/reference/null-safety.html[null-safety]. More details
are available in the <<languages#kotlin-null-safety,Kotlin support documentation>>.
== JSR 305 meta-annotations
Spring annotations are meta-annotated with https://jcp.org/en/jsr/detail?id=305[JSR 305]
......
......@@ -14,6 +14,7 @@ Spring. It includes the following topics:
[[resources-introduction]]
== Introduction
......@@ -28,6 +29,7 @@ such as a method to check for the existence of the resource being pointed to.
[[resources-resource]]
== The Resource Interface
......@@ -114,6 +116,7 @@ wrapped `URL` to do its work.
[[resources-implementations]]
== Built-in Resource Implementations
......@@ -163,18 +166,18 @@ to the filesystem. To address this, the various `Resource` implementations alway
resolution as a `java.net.URL`.
A `ClassPathResource` is created by Java code by explicitly using the `ClassPathResource`
constructor but is often created implicitly when you call an API method that
takes a `String` argument meant to represent a path. For the latter case, a
JavaBeans `PropertyEditor` recognizes the special prefix, `classpath:`, on the string
path and creates a `ClassPathResource` in that case.
constructor but is often created implicitly when you call an API method that takes a
`String` argument meant to represent a path. For the latter case, a JavaBeans
`PropertyEditor` recognizes the special prefix, `classpath:`, on the string path and
creates a `ClassPathResource` in that case.
[[resources-implementations-filesystemresource]]
=== `FileSystemResource`
This is a `Resource` implementation for `java.io.File` handles. It supports
resolution as a `File` and as a `URL`.
This is a `Resource` implementation for `java.io.File` and `java.nio.file.Path` handles.
It supports resolution as a `File` and as a `URL`.
......@@ -316,6 +319,7 @@ The following table summarizes the strategy for converting `String` objects to `
[[resources-resourceloaderaware]]
== The `ResourceLoaderAware` interface
......@@ -360,6 +364,7 @@ annotation. For more information, see <<beans-autowired-annotation>>.
[[resources-as-dependencies]]
== Resources as Dependencies
......@@ -411,6 +416,7 @@ The following two examples show how to force a `ClassPathResource` and a
[[resources-app-ctx]]
== Application Contexts and Resource Paths
......@@ -470,7 +476,6 @@ Using `FileSystemXmlApplicationContext` loads the bean definitions from the clas
unprefixed paths are still treated as filesystem paths.
[[resources-app-ctx-classpathxml]]
==== Constructing `ClassPathXmlApplicationContext` Instances -- Shortcuts
......@@ -506,8 +511,8 @@ files named `services.xml` and `daos.xml` (which are on the classpath) can be in
----
====
See the {api-spring-framework}/jca/context/SpringContextResourceAdapter.html[`ClassPathXmlApplicationContext` Javadoc] for details
on the various constructors.
See the {api-spring-framework}/jca/context/SpringContextResourceAdapter.html[`ClassPathXmlApplicationContext`]
javadoc for details on the various constructors.
......@@ -532,7 +537,6 @@ You cannot use the `classpath*:` prefix to construct an actual `Resource`, as
a resource points to just one resource at a time.
[[resources-app-ctx-ant-patterns-in-paths]]
==== Ant-style Patterns
......@@ -561,26 +565,23 @@ the wildcards.
[[resources-app-ctx-portability]]
===== Implications on Portability
If the specified path is already a file URL (either implicitly because
the base `ResourceLoader` is a filesystem one or explicitly), wildcarding is guaranteed to work in
a completely portable fashion.
If the specified path is already a file URL (either implicitly because the base
`ResourceLoader` is a filesystem one or explicitly), wildcarding is guaranteed to
work in a completely portable fashion.
If the specified path is a classpath location, the resolver must obtain the last
non-wildcard path segment URL by making a `Classloader.getResource()` call. Since this is just
a node of the path (not the file at the end), it is actually undefined (in the
`ClassLoader` Javadoc) exactly what sort of a URL is returned in this case. In
practice, it is always a `java.io.File` representing the directory (where the classpath
resource resolves to a filesystem location) or a jar URL of some sort w(here the
classpath resource resolves to a jar location). Still, there is a portability concern on
this operation.
non-wildcard path segment URL by making a `Classloader.getResource()` call. Since this
is just a node of the path (not the file at the end), it is actually undefined (in the
`ClassLoader` javadoc) exactly what sort of a URL is returned in this case. In practice,
it is always a `java.io.File` representing the directory (where the classpath resource
resolves to a filesystem location) or a jar URL of some sort (where the classpath resource
resolves to a jar location). Still, there is a portability concern on this operation.
If a jar URL is obtained for the last non-wildcard segment, the resolver must be able to
get a `java.net.JarURLConnection` from it or manually parse the jar URL, to be able to
walk the contents of the jar and resolve the wildcard. This does work in most
environments but fails in others, and we strongly recommend that the wildcard
resolution of resources coming from jars be thoroughly tested in your specific
environment before you rely on it.
walk the contents of the jar and resolve the wildcard. This does work in most environments
but fails in others, and we strongly recommend that the wildcard resolution of resources
coming from jars be thoroughly tested in your specific environment before you rely on it.
[[resources-classpath-wildcards]]
......@@ -621,7 +622,6 @@ class loader hierarchy and then, off each resource, the same `PathMatcher` resol
strategy described earlier is used for the wildcard subpath.
[[resources-wildcards-in-path-other-stuff]]
==== Other Notes Relating to Wildcards
......@@ -640,10 +640,10 @@ as well, but this is not guaranteed to lead to portable behavior.
[NOTE]
====
The scanning of classpath packages requires the presence of corresponding directory
entries in the classpath. When you build JARs with Ant, do not
activate the files-only switch of the JAR task. Also, classpath directories may not
get exposed based on security policies in some environments -- for example, stand-alone applications on
JDK 1.7.0_45 and higher (which requires 'Trusted-Library' to be set up in your manifests. See
entries in the classpath. When you build JARs with Ant, do not activate the files-only
switch of the JAR task. Also, classpath directories may not get exposed based on security
policies in some environments -- for example, stand-alone applications on JDK 1.7.0_45
and higher (which requires 'Trusted-Library' to be set up in your manifests. See
http://stackoverflow.com/questions/19394570/java-jre-7u45-breaks-classloader-getresources).
On JDK 9's module path (Jigsaw), Spring's classpath scanning generally works as expected.
......
[[validation]]
= Validation, Data Binding, and Type Conversion
There are pros and cons for considering validation as business logic, and Spring offers
a design for validation (and data binding) that does not exclude either one of them.
Specifically, validation should not be tied to the web tier and should be easy to localize,
......@@ -45,6 +43,7 @@ plugging in validation logic without the use of annotations.
[[validator]]
== Validation by Using Spring's Validator Interface
......@@ -105,10 +104,10 @@ example implements `Validator` for `Person` instances:
----
====
The `static` `rejectIfEmpty(..)` method on the `ValidationUtils` class
is used to reject the `name` property if it is `null` or the empty string. See
at the {api-spring-framework}/validation/ValidationUtils.html[`ValidationUtils` Javadoc] to see what functionality it provides besides the
example shown previously.
The `static` `rejectIfEmpty(..)` method on the `ValidationUtils` class is used to
reject the `name` property if it is `null` or the empty string. Have a look at the
{api-spring-framework}/validation/ValidationUtils.html[`ValidationUtils`] javadoc
to see what functionality it provides besides the example shown previously.
While it is certainly possible to implement a single `Validator` class to validate each
of the nested objects in a rich object, it may be better to encapsulate the validation
......@@ -166,7 +165,8 @@ as the following example shows:
Validation errors are reported to the `Errors` object passed to the validator. In the case
of Spring Web MVC, you can use the `<spring:bind/>` tag to inspect the error messages, but
you can also inspect the `Errors` object yourself. More information about the
methods it offers can be found in the {api-spring-framework}validation/Errors.html[Javadoc].
methods it offers can be found in the {api-spring-framework}validation/Errors.html[javadoc].
......@@ -191,14 +191,14 @@ the field name and the second includes the type of the field). This is done as a
convenience to aid developers when targeting error messages.
More information on the `MessageCodesResolver` and the default strategy can be found
in the Javadoc of
{api-spring-framework}/validation/MessageCodesResolver.html[`MessageCodesResolver`]
and
in the javadoc of
{api-spring-framework}/validation/MessageCodesResolver.html[`MessageCodesResolver`] and
{api-spring-framework}/validation/DefaultMessageCodesResolver.html[`DefaultMessageCodesResolver`],
respectively.
[[beans-beans]]
== Bean Manipulation and the `BeanWrapper`
......@@ -210,16 +210,16 @@ more information about JavaBeans and the specification, see
http://docs.oracle.com/javase/8/docs/api/java/beans/package-summary.html[javabeans].
One quite important class in the beans package is the `BeanWrapper` interface and its
corresponding implementation (`BeanWrapperImpl`). As quoted from the Javadoc, the
corresponding implementation (`BeanWrapperImpl`). As quoted from the javadoc, the
`BeanWrapper` offers functionality to set and get property values (individually or in
bulk), get property descriptors, and query properties to determine if they are
readable or writable. Also, the `BeanWrapper` offers support for nested properties,
enabling the setting of properties on sub-properties to an unlimited depth. The
`BeanWrapper` also supports the ability to add standard JavaBeans `PropertyChangeListeners`
and `VetoableChangeListeners`, without the need for supporting code in the target class.
Last but not least, the `BeanWrapper` provides support for setting indexed
properties. The `BeanWrapper` usually is not used by application code directly but is used by
the `DataBinder` and the `BeanFactory`.
Last but not least, the `BeanWrapper` provides support for setting indexed properties.
The `BeanWrapper` usually is not used by application code directly but is used by the
`DataBinder` and the `BeanFactory`.
The way the `BeanWrapper` works is partly indicated by its name: it wraps a bean to
perform actions on that bean, such as setting and retrieving properties.
......@@ -229,9 +229,9 @@ perform actions on that bean, such as setting and retrieving properties.
[[beans-beans-conventions]]
=== Setting and Getting Basic and Nested Properties
Setting and getting properties is done by using the `setPropertyValue`, `setPropertyValues`,
`getPropertyValue`, and `getPropertyValues` methods that both come with a couple of overloaded variants.
Springs Javadoc describes them all in more detail.
Setting and getting properties is done by using the `setPropertyValue`,
`setPropertyValues`, `getPropertyValue`, and `getPropertyValues` methods which come
with a couple of overloaded variants. Springs javadoc describes them in more detail.
The JavaBeans specification has conventions for indicating properties of an
object. The following table shows some examples of these conventions:
......@@ -359,7 +359,7 @@ behavior can be achieved by registering custom editors of type
`java.beans.PropertyEditor`. Registering custom editors on a `BeanWrapper` or,
alternatively, in a specific IoC container (as mentioned in the previous chapter), gives it
the knowledge of how to convert properties to the desired type. For more about
`PropertyEditor`, see https://docs.oracle.com/javase/8/docs/api/java/beans/package-summary.html[the Javadoc of the `java.beans` package from Oracle].
`PropertyEditor`, see https://docs.oracle.com/javase/8/docs/api/java/beans/package-summary.html[the javadoc of the `java.beans` package from Oracle].
A couple of examples where property editing is used in Spring:
......@@ -431,8 +431,8 @@ the various `PropertyEditor` implementations that Spring provides:
| Can resolve strings to `java.util.regex.Pattern` objects and vice-versa.
| `PropertiesEditor`
| Can convert strings (formatted with the format defined in the Javadoc
of the `java.util.Properties` class) to `Properties` objects. By default, registered
| Can convert strings (formatted with the format defined in the javadoc of the
`java.util.Properties` class) to `Properties` objects. By default, registered
by `BeanWrapperImpl`.
| `StringTrimmerEditor`
......@@ -625,8 +625,6 @@ Finally, the following example shows how to use `CustomEditorConfigurer` to regi
----
====
[[beans-beans-conversion-customeditor-registration-per]]
===== Using `PropertyEditorRegistrar`
......@@ -724,6 +722,7 @@ registration code be encapsulated in a class and then shared amongst as many
[[core-convert]]
== Spring Type Conversion
......@@ -881,9 +880,9 @@ the target collection type to resolve the collection's element type. This lets e
element in the source array be converted to the collection element type before the
collection is set on the target field.
NOTE: Because `GenericConverter` is a more complex SPI interface, you should use it only when you need it.
Favor `Converter` or `ConverterFactory` for basic type conversion needs.
NOTE: Because `GenericConverter` is a more complex SPI interface, you should use
it only when you need it. Favor `Converter` or `ConverterFactory` for basic type
conversion needs.
[[core-convert-ConditionalGenericConverter-SPI]]
......@@ -1067,6 +1066,7 @@ no need to create a specific converter to convert from a `Collection` of `S` to
[[format]]
== Spring Field Formatting
......@@ -1387,6 +1387,7 @@ See <<web.adoc#mvc-config-conversion, Conversion and Formatting>> in the Spring
[[format-configuring-formatting-globaldatetimeformat]]
== Configuring a Global Date and Time Format
......@@ -1613,7 +1614,6 @@ the Spring Validation API, as the following example shows:
====
[[validation-beanvalidation-spring-constraints]]
==== Configuring Custom Constraints
......@@ -1681,10 +1681,10 @@ through a `MethodValidationPostProcessor` bean definition, as follows:
----
====
To be eligible for Spring-driven method validation, all target classes need
to be annotated with Spring's `@Validated` annotation. (Optionally, you can also declare the
validation groups to use.) See the {api-spring-framework}/validation/beanvalidation/MethodValidationPostProcessor.html[`MethodValidationPostProcessor` Javadoc]
for setup details with the Hibernate Validator and Bean Validation 1.1 providers.
To be eligible for Spring-driven method validation, all target classes need to be annotated with
Spring's `@Validated` annotation. (Optionally, you can also declare the validation groups to use.)
See the {api-spring-framework}/validation/beanvalidation/MethodValidationPostProcessor.html[`MethodValidationPostProcessor`]
javadoc for setup details with the Hibernate Validator and Bean Validation 1.1 providers.
[[validation-beanvalidation-spring-other]]
......@@ -1693,7 +1693,8 @@ for setup details with the Hibernate Validator and Bean Validation 1.1 providers
The default `LocalValidatorFactoryBean` configuration suffices for most
cases. There are a number of configuration options for various Bean Validation
constructs, from message interpolation to traversal resolution. See the
{api-spring-framework}/validation/beanvalidation/LocalValidatorFactoryBean.html[`LocalValidatorFactoryBean` Javadoc] for more information on these options.
{api-spring-framework}/validation/beanvalidation/LocalValidatorFactoryBean.html[`LocalValidatorFactoryBean`]
javadoc for more information on these options.
......
......@@ -2,6 +2,7 @@
[[xsd-schemas]]
== XML Schemas
......
此差异已折叠。
= Appendix
[[xsd-schemas]]
== XML Schemas
......@@ -28,8 +30,8 @@ correct schema so that the elements in the `jee` namespace are available to you:
__xmlns:jee="http://www.springframework.org/schema/jee"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee.xsd"__>
<!-- bean definitions here -->
<!-- bean definitions here -->
</beans>
----
====
......@@ -39,8 +41,7 @@ correct schema so that the elements in the `jee` namespace are available to you:
[[xsd-schemas-jee-jndi-lookup]]
==== <jee:jndi-lookup/> (simple)
The following example shows how to use JNDI to look up a data source without the `jee`
schema:
The following example shows how to use JNDI to look up a data source without the `jee` schema:
====
[source,xml,indent=0]
......@@ -329,8 +330,9 @@ are available to you:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:jms="http://www.springframework.org/schema/jms"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd"__>
<!-- bean definitions here -->
</beans>
----
====
......@@ -366,8 +368,9 @@ the correct schema so that the elements in the `cache` namespace are available t
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:cache="http://www.springframework.org/schema/cache"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache.xsd"__>
<!-- bean definitions here -->
</beans>
----
====
此差异已折叠。
......@@ -7,7 +7,6 @@
:tabsize: 4
:docinfo1:
include::languages/kotlin.adoc[leveloffset=+1]
include::languages/groovy.adoc[leveloffset=+1]
......
......@@ -952,7 +952,9 @@ are available to you:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
__xmlns:lang="http://www.springframework.org/schema/lang"__ xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
__http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd"__> <!-- bean definitions here -->
__http://www.springframework.org/schema/lang http://www.springframework.org/schema/lang/spring-lang.xsd"__>
<!-- bean definitions here -->
</beans>
----
......
......@@ -113,7 +113,7 @@ libraries that depend on Spring.
* Care about API design. The Spring team puts a lot of thought and time into making APIs
that are intuitive and that hold up across many versions and many years.
* Set high standards for code quality. The Spring Framework puts a strong emphasis on
meaningful, current, and accurate Javadoc. It is one of very few projects that can claim
meaningful, current, and accurate javadoc. It is one of very few projects that can claim
clean code structure with no circular dependencies between packages.
......
......@@ -12,6 +12,7 @@ related to use of the `WebTestClient`.
[[webtestclient-setup]]
== Setup
......@@ -137,6 +138,7 @@ are readily available following `bindToServer`. For all others, you need to use
[[webtestclient-tests]]
== Writing Tests
......
此差异已折叠。
......@@ -23,6 +23,7 @@ include::web/webflux-websocket.adoc[leveloffset=+1]
[[webflux-test]]
== Testing
[.small]#<<web.adoc#testing,Same in Spring MVC>>#
......@@ -37,6 +38,7 @@ server. You can use the `WebTestClient` for end-to-end integration tests, too.
//[[webflux-threading-model]]
//=== Threading model
// TODO Once we have content for this heading, we should un-comment the heading and
......@@ -44,6 +46,7 @@ server. You can use the `WebTestClient` for end-to-end integration tests, too.
[[webflux-reactive-libraries]]
== Reactive Libraries
......
......@@ -14,8 +14,10 @@ popular third party web frameworks.
[[web-integration-common]]
== Common Configuration
Before diving into the integration specifics of each supported web framework, let us
first take a look at the Spring configuration that is not specific to any one web
framework. (This section is equally applicable to Spring's own web framework, Spring
......@@ -105,6 +107,7 @@ has more detail on its specific integration strategies.
[[jsf]]
== JSF
......@@ -173,6 +176,7 @@ The following example shows how to use `FacesContextUtils`:
[[struts]]
== Apache Struts 2.x
......@@ -189,6 +193,7 @@ built-in Spring integration shipped with Struts.
[[tapestry]]
== Tapestry 5.x
......@@ -205,8 +210,10 @@ Spring].
[[web-integration-resources]]
== Further Resources
The following links go to further resources about the various web frameworks described in this
chapter.
......
[[web-uricomponents]]
= UriComponents
[.small]#Spring MVC and Spring WebFlux#
......
......@@ -7,6 +7,7 @@ describes how to do so.
[[webflux-cors-intro]]
== Introduction
[.small]#<<web.adoc#mvc-cors-intro,Same as in Spring MVC>>#
......@@ -23,6 +24,7 @@ powerful workarounds based on IFRAME or JSONP.
[[webflux-cors-processing]]
== Processing
[.small]#<<web.adoc#mvc-cors-processing,Same as in Spring MVC>>#
......@@ -72,6 +74,7 @@ To learn more from the source or to make advanced customizations, see:
[[webflux-cors-controller]]
== `@CrossOrigin`
[.small]#<<web.adoc#mvc-cors-controller,Same as in Spring MVC>>#
......@@ -170,6 +173,7 @@ public class AccountController {
[[webflux-cors-global]]
== Global Configuration
[.small]#<<web.adoc#mvc-cors-global,Same as in Spring MVC>>#
......@@ -220,6 +224,7 @@ public class WebConfig implements WebFluxConfigurer {
[[webflux-cors-webfilter]]
== CORS `WebFilter`
[.small]#<<web.adoc#mvc-cors-filter,Same as in Spring MVC>>#
......
......@@ -8,6 +8,7 @@ the same <<web-reactive.adoc#webflux-reactive-spring-web>> foundation.
[[webflux-fn-overview]]
== Overview
......@@ -71,6 +72,7 @@ Most applications can run through the WebFlux Java configuration, see <<webflux-
[[webflux-fn-handler-functions]]
== HandlerFunction
......@@ -245,6 +247,7 @@ found. If it is not found, we use `switchIfEmpty(Mono<T>)` to return a 404 Not F
[[webflux-fn-router-functions]]
== `RouterFunction`
......@@ -320,6 +323,7 @@ RouterFunction<ServerResponse> personRoute =
[[webflux-fn-running]]
== Running a Server
......@@ -394,6 +398,7 @@ public class WebConfig implements WebFluxConfigurer {
[[webflux-fn-handler-filter-function]]
== `HandlerFilterFunction`
......
......@@ -3,9 +3,10 @@
[.small]#<<web.adoc#mvc-view,Same as in Spring MVC>>#
The use of view technologies in Spring WebFlux is pluggable. Whether you decide to
use Thymeleaf, FreeMarker, or some other view technology is primarily a matter of a configuration change.
This chapter covers the view technologies integrated with Spring WebFlux. We assume you are
already familiar with <<webflux-viewresolution>>.
use Thymeleaf, FreeMarker, or some other view technology is primarily a matter of a
configuration change. This chapter covers the view technologies integrated with Spring
WebFlux. We assume you are already familiar with <<webflux-viewresolution>>.
......@@ -29,6 +30,7 @@ http://forum.thymeleaf.org/Thymeleaf-3-0-8-JUST-PUBLISHED-td4030687.html[announc
[[webflux-view-freemarker]]
== FreeMarker
[.small]#<<web.adoc#mvc-view-freemarker,Same as in Spring MVC>>#
......@@ -116,6 +118,7 @@ the `Configuration` object.
[[webflux-view-script]]
== Script Views
[.small]#<<web.adoc#mvc-view-script,Same as in Spring MVC>>#
......@@ -280,6 +283,7 @@ for more configuration examples.
[[webflux-view-httpmessagewriter]]
== JSON and XML
[.small]#<<web.adoc#mvc-view-jackson,Same as in Spring MVC>>#
......
......@@ -14,6 +14,7 @@ and others can be plugged in through a `ClientHttpConnector`.
[[webflux-client-builder]]
== Configuration
......@@ -241,6 +242,7 @@ shows:
[[webflux-client-retrieve]]
== `retrieve()`
......@@ -294,6 +296,7 @@ as the following example shows:
[[webflux-client-exchange]]
== `exchange()`
......@@ -335,6 +338,7 @@ is closed and is not placed back in the pool.
[[webflux-client-body]]
== Request Body
......@@ -497,6 +501,7 @@ inline-style, through the built-in `BodyInserters`, as the following example sho
[[webflux-client-filter]]
== Client Filters
......@@ -581,6 +586,7 @@ WebClient client = webClient.mutate()
[[webflux-client-testing]]
== Testing
......
......@@ -5,12 +5,11 @@
This part of the reference documentation covers support for reactive-stack WebSocket
messaging.
include::websocket-intro.adoc[leveloffset=+1]
[[webflux-websocket-server]]
== WebSocket API
[.small]#<<web.adoc#websocket-server,Same as in the Servlet stack>>#
......
......@@ -17,6 +17,7 @@ for example, Spring MVC controllers with the reactive `WebClient`.
[[webflux-new-framework]]
== Overview
......@@ -291,6 +292,7 @@ libraries, see their respective documentation.
[[webflux-reactive-spring-web]]
== Reactive Core
......@@ -452,7 +454,6 @@ access not only to the request and response, but also to request and session att
access to parsed form data, multipart data, and more.
[[webflux-web-handler-api-special-beans]]
==== Special bean types
......@@ -505,7 +506,6 @@ The table below lists the components that `WebHttpHandlerBuilder` detects:
|===
[[webflux-form-data]]
==== Form Data
......@@ -525,7 +525,6 @@ The `DefaultServerWebExchange` uses the configured `HttpMessageReader` to parse
(see the <<webflux-web-handler-api,Web Handler API>>).
[[webflux-multipart]]
==== Multipart Data
[.small]#<<web.adoc#mvc-multipart,Same as in Spring MVC>>#
......@@ -555,7 +554,6 @@ parsing multipart data in full. By contrast, you can use `@RequestBody` to decod
content to `Flux<Part>` without collecting to a `MultiValueMap`.
[[webflux-forwarded-headers]]
==== Forwarded Headers
[.small]#<<web.adoc#filters-forwarded-headers,Same as in Spring MVC>>#
......@@ -598,7 +596,6 @@ as declaring it as a Spring bean and (optionally) expressing precedence by using
the bean declaration or by implementing `Ordered`.
[[webflux-filters-cors]]
==== CORS
[.small]#<<web.adoc#filters-cors,Same as in Spring MVC>>#
......@@ -669,7 +666,6 @@ JSON, Jackson Smile, JAXB2, Protocol Buffers, and other web-specific HTTP messag
readers and writers for form data, multipart requests, and server-sent events.
[[webflux-codecs-jackson]]
==== Jackson JSON
......@@ -702,7 +698,6 @@ or a sequence of strings represent serialized JSON content, to be rendered by th
use `Flux#collectToList()` and provide a `Mono<List<String>>` to be serialized.
[[webflux-codecs-forms]]
==== Form Data
......@@ -719,7 +714,6 @@ request body. For this reason, applications are expected to go through `ServerWe
consistently for access to the cached form data versus reading from the raw request body.
[[webflux-codecs-multipart]]
==== Multipart Data
......@@ -741,7 +735,6 @@ for repeated, map-like access to parts, or otherwise rely on the
`SynchronossPartHttpMessageReader` for a one-time access to `Flux<Part>`.
[[webflux-codecs-streaming]]
==== Streaming
[.small]#<<web.adoc#mvc-ann-async-http-streaming,Same as in Spring MVC>>#
......@@ -786,7 +779,6 @@ while a fully formatted prefix based on that ID is available from
,while a fully formatted prefix is available from `ClientRequest#logPrefix()`.
[[webflux-logging-sensitive-data]]
==== Logging Sensitive Data
[.small]#<<web.adoc#mvc-logging-sensitive-data,Same as in Spring MVC>>#
......@@ -829,6 +821,7 @@ WebClient webClient = WebClient.builder()
[[webflux-dispatcher-handler]]
== `DispatcherHandler`
[.small]#<<web.adoc#mvc-servlet,Same as in Spring MVC>>#
......@@ -1012,7 +1005,6 @@ supported through a dedicated <<webflux-resulthandling,HandlerResultHandler>> th
instance. The `View` is then used to render the response.
[[webflux-viewresolution-handling]]
==== Handling
[.small]#<<web.adoc#mvc-handling,Same as in Spring MVC>>#
......@@ -1049,7 +1041,6 @@ dedicated configuration API for view resolution.
See <<webflux-view>> for more on the view technologies integrated with Spring WebFlux.
[[webflux-redirecting-redirect-prefix]]
==== Redirecting
[.small]#<<web.adoc#mvc-redirecting-redirect-prefix,Same as in Spring MVC>>#
......@@ -1081,6 +1072,7 @@ always selected and used if they match the requested media type.
[[webflux-controller]]
== Annotated Controllers
[.small]#<<web.adoc#mvc-controller,Same as in Spring MVC>>#
......@@ -1192,7 +1184,6 @@ The following example uses type and method level mappings:
====
[[webflux-ann-requestmapping-uri-templates]]
==== URI Patterns
[.small]#<<web.adoc#mvc-ann-requestmapping-uri-templates,Same as in Spring MVC>>#
......@@ -1295,7 +1286,6 @@ Catch-all patterns (for example, `**`, `{*varName}`) are excluded from the scori
sorted last instead. If two patterns are both catch-all, the longer is chosen.
[[webflux-ann-requestmapping-consumes]]
==== Consumable Media Types
[.small]#<<web.adoc#mvc-ann-requestmapping-consumes,Same as in Spring MVC>>#
......@@ -1325,7 +1315,6 @@ TIP: `MediaType` provides constants for commonly used media types -- for example
`APPLICATION_JSON_VALUE` and `APPLICATION_XML_VALUE`.
[[webflux-ann-requestmapping-produces]]
==== Producible Media Types
[.small]#<<web.adoc#mvc-ann-requestmapping-produces,Same as in Spring MVC>>#
......@@ -1361,7 +1350,6 @@ TIP: `MediaType` provides constants for commonly used media types -- e.g.
`APPLICATION_JSON_UTF8_VALUE`, `APPLICATION_XML_VALUE`.
[[webflux-ann-requestmapping-params-and-headers]]
==== Parameters and Headers
[.small]#<<web.adoc#mvc-ann-requestmapping-params-and-headers,Same as in Spring MVC>>#
......@@ -1397,7 +1385,6 @@ You can also use the same with request header conditions, as the follwing exampl
====
[[webflux-ann-requestmapping-head-options]]
==== HTTP HEAD, OPTIONS
[.small]#<<web.adoc#mvc-ann-requestmapping-head-options,Same as in Spring MVC>>#
......@@ -1419,7 +1406,6 @@ You can explicitly map a `@RequestMapping` method to HTTP HEAD and HTTP OPTIONS,
is not necessary in the common case.
[[webflux-ann-requestmapping-composed]]
==== Custom Annotations
[.small]#<<web.adoc#mvc-ann-requestmapping-composed,Same as in Spring MVC>>#
......@@ -1441,7 +1427,6 @@ logic. This is a more advanced option that requires sub-classing
you can check the custom attribute and return your own `RequestCondition`.
[[webflux-ann-requestmapping-registration]]
==== Explicit Registrations
[.small]#<<web.adoc#mvc-ann-requestmapping-registration,Same as in Spring MVC>>#
......@@ -1487,7 +1472,6 @@ public class MyConfig {
supported controller method arguments and return values.
[[webflux-ann-arguments]]
==== Method Arguments
[.small]#<<web.adoc#mvc-ann-arguments,Same as in Spring MVC>>#
......@@ -1697,7 +1681,6 @@ can be customized through a `WebDataBinder` (see <<mvc-ann-initbinder>>) or by r
<<core.adoc#format, Spring Field Formatting>>).
[[webflux-ann-matrix-variables]]
==== Matrix Variables
[.small]#<<web.adoc#mvc-ann-matrix-variables,Same as in Spring MVC>>#
......@@ -1791,7 +1774,6 @@ To get all matrix variables, use a `MultiValueMap`, as the following example sho
====
[[webflux-ann-requestparam]]
==== `@RequestParam`
[.small]#<<web.adoc#mvc-ann-requestparam,Same as in Spring MVC>>#
......@@ -1847,7 +1829,6 @@ and is not resolved by any other argument resolver is treated as if it were anno
with `@RequestParam`.
[[webflux-ann-requestheader]]
==== `@RequestHeader`
[.small]#<<web.adoc#mvc-ann-requestheader,Same as in Spring MVC>>#
......@@ -1900,7 +1881,6 @@ example, a method parameter annotated with `@RequestHeader("Accept")` may be of
`String` but also of `String[]` or `List<String>`.
[[webflux-ann-cookievalue]]
==== `@CookieValue`
[.small]#<<web.adoc#mvc-ann-cookievalue,Same as in Spring MVC>>#
......@@ -1936,7 +1916,6 @@ Type conversion is applied automatically if the target method parameter type is
`String`. See <<mvc-ann-typeconversion>>.
[[webflux-ann-modelattrib-method-args]]
==== `@ModelAttribute`
[.small]#<<web.adoc#mvc-ann-modelattrib-method-args,Same as in Spring MVC>>#
......@@ -2044,7 +2023,6 @@ and is not resolved by any other argument resolver is treated as if it were anno
with `@ModelAttribute`.
[[webflux-ann-sessionattributes]]
==== `@SessionAttributes`
[.small]#<<web.adoc#mvc-ann-sessionattributes,Same as in Spring MVC>>#
......@@ -2101,7 +2079,6 @@ as the following example shows:
====
[[webflux-ann-sessionattribute]]
==== `@SessionAttribute`
[.small]#<<web.adoc#mvc-ann-sessionattribute,Same as in Spring MVC>>#
......@@ -2151,7 +2128,6 @@ as the following example shows:
====
[[webflux-multipart-forms]]
==== Multipart Content
[.small]#<<web.adoc#mvc-multipart-forms,Same as in Spring MVC>>#
......@@ -2295,7 +2271,6 @@ To access multipart data sequentially, in streaming fashion, you can use `@Reque
====
[[webflux-ann-requestbody]]
==== `@RequestBody`
[.small]#<<web.adoc#mvc-ann-requestbody,Same as in Spring MVC>>#
......@@ -2352,7 +2327,6 @@ example uses a `BindingResult` argument`:
====
[[webflux-ann-httpentity]]
==== `HttpEntity`
[.small]#<<web.adoc#mvc-ann-httpentity,Same as in Spring MVC>>#
......@@ -2373,7 +2347,6 @@ container object that exposes request headers and the body. The following exampl
====
[[webflux-ann-responsebody]]
==== `@ResponseBody`
[.small]#<<web.adoc#mvc-ann-responsebody,Same as in Spring MVC>>#
......@@ -2409,7 +2382,6 @@ You can use the <<webflux-config-message-codecs>> option of the <<webflux-config
configure or customize message writing.
[[webflux-ann-responseentity]]
==== `ResponseEntity`
[.small]#<<web.adoc#mvc-ann-responseentity,Same as in Spring MVC>>#
......@@ -2434,8 +2406,6 @@ produce the `ResponseEntity` asynchronously, and/or single and multi-value react
for the body.
[[webflux-ann-jackson]]
==== Jackson JSON
......@@ -2549,9 +2519,8 @@ The following example adds one attribute only:
----
====
NOTE: When a name is not explicitly specified, a default name is chosen based on the `Object`
type, as explained in the Javadoc for
{api-spring-framework}/core/Conventions.html[`Conventions`].
NOTE: When a name is not explicitly specified, a default name is chosen based on the type,
as explained in the javadoc for {api-spring-framework}/core/Conventions.html[`Conventions`].
You can always assign an explicit name by using the overloaded `addAttribute` method or
through the name attribute on `@ModelAttribute` (for a return value).
......@@ -2714,7 +2683,6 @@ Support for `@ExceptionHandler` methods in Spring WebFlux is provided by the
for more detail.
[[webflux-ann-rest-exceptions]]
==== REST API exceptions
[.small]#<<web.adoc#mvc-ann-rest-exceptions,Same as in Spring MVC>>#
......@@ -2779,30 +2747,26 @@ as the following example shows:
The preceding selectors are evaluated at runtime and may negatively impact
performance if you use them extensively. See the
{api-spring-framework}/web/bind/annotation/ControllerAdvice.html[`@ControllerAdvice`]
Javadoc for more details.
javadoc for more details.
include::webflux-functional.adoc[leveloffset=+1]
[[webflux-uri-building]]
== URI Links
[.small]#<<web.adoc#mvc-uri-building,Same as in Spring MVC>>#
This section describes various options available in the Spring Framework to prepare URIs.
include::web-uris.adoc[leveloffset=+2]
include::webflux-cors.adoc[leveloffset=+1]
[[webflux-web-security]]
== Web Security
[.small]#<<web.adoc#mvc-web-security,Same as in Spring MVC>>#
......@@ -2816,12 +2780,11 @@ reference documentation, including:
* {doc-spring-security}/html5/#csrf[CSRF Protection]
* {doc-spring-security}/html5/#headers[Security Response Headers]
include::webflux-view.adoc[leveloffset=+1]
[[webflux-caching]]
== HTTP Caching
[.small]#<<web.adoc#mvc-caching,Same as in Spring MVC>>#
......@@ -2946,6 +2909,7 @@ for optimal performance. See the section on configuring <<webflux-config-static-
[[webflux-config]]
== WebFlux Config
[.small]#<<web.adoc#mvc-config,Same as in Spring MVC>>#
......@@ -3358,7 +3322,7 @@ match to incoming URLs without versions (for example, `/jquery/jquery.min.js` to
[.small]#<<web.adoc#mvc-config-path-matching,Same as in Spring MVC>>#
You can customize options related to path matching. For details on the individual options, see the
{api-spring-framework}/web/reactive/config/PathMatchConfigurer.html[`PathMatchConfigurer`] Javadoc.
{api-spring-framework}/web/reactive/config/PathMatchConfigurer.html[`PathMatchConfigurer`] javadoc.
The following example shows how to use `PathMatchConfigurer`:
====
......@@ -3430,6 +3394,7 @@ the classpath.
[[webflux-http2]]
== HTTP/2
[.small]#<<web.adoc#mvc-http2,Same as in Spring MVC>>#
......
......@@ -5,6 +5,7 @@ This section describes options for client-side access to REST endpoints.
[[webmvc-resttemplate]]
== `RestTemplate`
......@@ -21,6 +22,7 @@ See <<integration.adoc#rest-client-access,REST Endpoints>> for details.
[[webmvc-webclient]]
== `WebClient`
......
......@@ -7,6 +7,7 @@ describes how to do so.
[[mvc-cors-intro]]
== Introduction
[.small]#<<web-reactive.adoc#webflux-cors-intro,Same as in Spring WebFlux>>#
......@@ -23,6 +24,7 @@ powerful workarounds based on IFRAME or JSONP.
[[mvc-cors-processing]]
== Processing
[.small]#<<web-reactive.adoc#webflux-cors-processing,Same as in Spring WebFlux>>#
......@@ -72,6 +74,7 @@ To learn more from the source or make advanced customizations, check the code be
[[mvc-cors-controller]]
== `@CrossOrigin`
[.small]#<<web-reactive.adoc#webflux-cors-controller,Same as in Spring WebFlux>>#
......@@ -167,6 +170,7 @@ public class AccountController {
[[mvc-cors-global]]
== Global Configuration
[.small]#<<web-reactive.adoc#webflux-cors-global,Same as in Spring WebFlux>>#
......@@ -191,7 +195,6 @@ should only be used where appropriate.
[[mvc-cors-global-java]]
=== Java Configuration
[.small]#<<web-reactive.adoc#webflux-cors-global,Same as in Spring WebFlux>>#
......@@ -253,6 +256,7 @@ as the following example shows:
[[mvc-cors-filter]]
== CORS Filter
[.small]#<<web-reactive.adoc#webflux-cors-webfilter,Same as in Spring WebFlux>>#
......
此差异已折叠。
......@@ -57,6 +57,7 @@ instructions of the cloud provider related to WebSocket support.
[[websocket-intro-architecture]]
== HTTP Versus WebSocket
......@@ -82,6 +83,7 @@ In the absence of that, they need to come up with their own conventions.
[[websocket-intro-when-to-use]]
== When to Use WebSockets
......
......@@ -7,12 +7,11 @@ This part of the reference documentation covers support for Servlet stack, WebSo
messaging that includes raw WebSocket interactions, WebSocket emulation through SockJS, and
publish-subscribe messaging through STOMP as a sub-protocol over WebSocket.
include::websocket-intro.adoc[leveloffset=+1]
[[websocket-server]]
== WebSocket API
[.small]#<<web-reactive.adoc#webflux-websocket-server,Same as in Spring WebFlux>>#
......@@ -478,6 +477,7 @@ The following example shows the XML configuration equivalent of the preceding ex
[[websocket-fallback]]
== SockJS Fallback
......@@ -846,7 +846,8 @@ jettyHttpClient.setExecutor(new QueuedThreadPool(1000));
----
====
The following example shows the server-side SockJS-related properties (see Javadoc for details) that you should also consider customizing:
The following example shows the server-side SockJS-related properties (see javadoc for details)
that you should also consider customizing:
====
[source,java,indent=0]
......@@ -874,6 +875,7 @@ The following example shows the server-side SockJS-related properties (see Javad
[[websocket-stomp]]
== STOMP
......@@ -1263,7 +1265,6 @@ methods, as described in the following topics:
* <<websocket-stomp-exception-handler>>
[[websocket-stomp-message-mapping]]
==== `@MessageMapping`
......@@ -1526,15 +1527,16 @@ public class WebSocketConfig implements WebSocketMessageBrokerConfigurer {
=== External Broker
The simple broker is great for getting started but supports only a subset of
STOMP commands (it does not support acks, receipts, and some other features), relies on a simple
message-sending loop, and is not suitable for clustering. As an alternative, you can upgrade your applications
to use a full-featured message broker.
STOMP commands (it does not support acks, receipts, and some other features),
relies on a simple message-sending loop, and is not suitable for clustering.
As an alternative, you can upgrade your applications to use a full-featured
message broker.
See the STOMP documentation for your message broker of choice (such as
http://www.rabbitmq.com/stomp.html[RabbitMQ],
http://activemq.apache.org/stomp.html[ActiveMQ], and others), install the broker,
and run it with STOMP support enabled. Then you can enable the STOMP broker relay (instead of the simple broker) in the
Spring configuration.
and run it with STOMP support enabled. Then you can enable the STOMP broker relay
(instead of the simple broker) in the Spring configuration.
The following example configuration enables a full-featured broker:
......@@ -1600,8 +1602,7 @@ dependencies to your project for TCP connection management.
Furthermore, application components (such as HTTP request handling methods,
business services, and others) can also send messages to the broker relay, as described
in <<websocket-stomp-handle-send>>, to broadcast messages to
subscribed WebSocket clients.
in <<websocket-stomp-handle-send>>, to broadcast messages to subscribed WebSocket clients.
In effect, the broker relay enables robust and scalable message broadcasting.
......@@ -1612,10 +1613,10 @@ In effect, the broker relay enables robust and scalable message broadcasting.
A STOMP broker relay maintains a single "`system`" TCP connection to the broker.
This connection is used for messages originating from the server-side application
only, not for receiving messages. You can configure the STOMP credentials (that is, the STOMP frame `login` and `passcode` headers)
for this connection. This
is exposed in both the XML namespace and Java configuration as the
`systemLogin` and `systemPasscode` properties with default values of `guest` and `guest`.
only, not for receiving messages. You can configure the STOMP credentials (that is,
the STOMP frame `login` and `passcode` headers) for this connection. This is exposed
in both the XML namespace and Java configuration as the `systemLogin` and
`systemPasscode` properties with default values of `guest` and `guest`.
The STOMP broker relay also creates a separate TCP connection for every connected
WebSocket client. You can configure the STOMP credentials that are used for all TCP
......@@ -2397,8 +2398,8 @@ In fact, if the capacity is left at its default value of Integer.MAX_VALUE,
the thread pool never increases beyond the core pool size, since
all additional tasks are queued.
See the Javadoc of `ThreadPoolExecutor` to learn how these
properties work and understand the various queuing strategies.
See the javadoc of `ThreadPoolExecutor` to learn how these properties work and
understand the various queuing strategies.
====
On the `clientOutboundChannel` side, it is all about sending messages to WebSocket
......@@ -2419,9 +2420,8 @@ messages to a client.
The general idea is that, at any given time, only a single thread can be used
to send to a client. All additional messages, meanwhile, get buffered, and you
can use these properties to decide how long sending a message is allowed to
take and how much data can be buffered in the meantime. See the
Javadoc and documentation of the XML schema for this configuration for
important additional details.
take and how much data can be buffered in the meantime. See the javadoc and
documentation of the XML schema for important additional details.
The following example shows a possible configuration:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册