diff --git a/src/docs/asciidoc/core.adoc b/src/docs/asciidoc/core.adoc
index cca7b74541..f2849ecbbf 100644
--- a/src/docs/asciidoc/core.adoc
+++ b/src/docs/asciidoc/core.adoc
@@ -10,16 +10,16 @@
This part of the reference documentation covers all the technologies that are
absolutely integral to the Spring Framework.
-Foremost amongst these is the Spring Framework's Inversion of Control (IoC) container. A
-thorough treatment of the Spring Framework's IoC container is closely followed by
-comprehensive coverage of Spring's Aspect-Oriented Programming (AOP) technologies. The
-Spring Framework has its own AOP framework, which is conceptually easy to understand
-and which successfully addresses the 80% sweet spot of AOP requirements in Java
-enterprise programming.
+Foremost amongst these is the Spring Framework's Inversion of Control (IoC) container.
+A thorough treatment of the Spring Framework's IoC container is closely followed by
+comprehensive coverage of Spring's Aspect-Oriented Programming (AOP) technologies.
+The Spring Framework has its own AOP framework, which is conceptually easy to
+understand and which successfully addresses the 80% sweet spot of AOP requirements
+in Java enterprise programming.
Coverage of Spring's integration with AspectJ (currently the richest -- in terms of
-features -- and certainly most mature AOP implementation in the Java enterprise space) is
-also provided.
+features -- and certainly most mature AOP implementation in the Java enterprise space)
+is also provided.
include::core/core-beans.adoc[leveloffset=+1]
diff --git a/src/docs/asciidoc/core/core-appendix.adoc b/src/docs/asciidoc/core/core-appendix.adoc
index f33484b984..2909e4e9d0 100644
--- a/src/docs/asciidoc/core/core-appendix.adoc
+++ b/src/docs/asciidoc/core/core-appendix.adoc
@@ -5,6 +5,7 @@
+
[[xsd-schemas]]
== XML Schemas
@@ -38,7 +39,6 @@ correct schema so that the tags in the `util` namespace are available to you):
====
-
[[xsd-schemas-util-constant]]
==== Using ``
@@ -78,8 +78,6 @@ developer's intent ("`inject this constant value`"), and it reads better:
----
====
-
-
[[xsd-schemas-util-frfb]]
===== Setting a Bean Property or Constructor Argument from a Field Value
@@ -139,10 +137,9 @@ described in the API documentation for the
class.
Injecting enumeration values into beans as either property or constructor arguments is
-easy to do in Spring. You do not actually have to do anything or know
-anything about the Spring internals (or even about classes such as the
-`FieldRetrievingFactoryBean`). The following example enumeration shows how easy injecting an
-enum value is:
+easy to do in Spring. You do not actually have to do anything or know anything about
+the Spring internals (or even about classes such as the `FieldRetrievingFactoryBean`).
+The following example enumeration shows how easy injecting an enum value is:
====
[source,java,indent=0]
@@ -186,7 +183,6 @@ Now consider the following setter of type `PersistenceContextType` and the corre
====
-
[[xsd-schemas-util-property-path]]
==== Using ``
@@ -359,7 +355,6 @@ The following example uses a `util:properties` element to make a more concise re
====
-
[[xsd-schemas-util-list]]
==== Using ``
@@ -424,7 +419,6 @@ following configuration:
If no `list-class` attribute is supplied, the container chooses a `List` implementation.
-
[[xsd-schemas-util-map]]
==== Using ``
@@ -489,7 +483,6 @@ following configuration:
If no `'map-class'` attribute is supplied, the container chooses a `Map` implementation.
-
[[xsd-schemas-util-set]]
==== Using ``
@@ -612,69 +605,64 @@ available to you:
====
-
[[xsd-schemas-context-pphc]]
==== Using ``
This element activates the replacement of `${...}` placeholders, which are resolved against a
-specified properties file (as a <>). This element is
+specified properties file (as a <>). This element is
a convenience mechanism that sets up a <> for you. If you need more control over the
`PropertyPlaceholderConfigurer`, you can explicitly define one yourself.
-
[[xsd-schemas-context-ac]]
==== Using ``
-This element activates the Spring infrastructure to detect annotations in bean
-classes:
+This element activates the Spring infrastructure to detect annotations in bean classes:
-* Spring's <> and
-<>
-* JSR 250's `@PostConstruct`,
-`@PreDestroy` and `@Resource` (if available)
-* JPA's `@PersistenceContext` and
-`@PersistenceUnit` (if available).
+* Spring's <> model
+* <> and `@Value`
+* JSR-250's `@Resource`, `@PostConstruct` and `@PreDestroy` (if available)
+* JPA's `@PersistenceContext` and `@PersistenceUnit` (if available)
+* Spring's <>
-Alternatively, you can choose to explicitly activate the
-individual `BeanPostProcessors` for those annotations.
+Alternatively, you can choose to explicitly activate the individual `BeanPostProcessors`
+for those annotations.
NOTE: This element does not activate processing of Spring's
-<> annotation. You can use the
-<`>> element for that purpose.
-
+<> annotation;
+you can use the <`>>
+element for that purpose. Similarly, Spring's
+<> need to be explicitly
+<> as well.
[[xsd-schemas-context-component-scan]]
==== Using ``
-This element is detailed in <>.
-
+This element is detailed in the section on <>.
[[xsd-schemas-context-ltw]]
==== Using ``
-This element is detailed in <>.
-
+This element is detailed in the section on <>.
[[xsd-schemas-context-sc]]
==== Using ``
-This element is detailed in <>.
-
+This element is detailed in the section on <>.
[[xsd-schemas-context-mbe]]
==== Using ``
-This element is detailed in <>.
+This element is detailed in the section on <>.
@@ -684,8 +672,8 @@ Configuring annotation based MBean export>>.
Last but not least, we have the elements in the `beans` schema. These elements
have been in Spring since the very dawn of the framework. Examples of the various elements
in the `beans` schema are not shown here because they are quite comprehensively covered
-in <>
-(and, indeed, in that entire <>).
+in <>
+(and, indeed, in that entire <>).
Note that you can add zero or more key-value pairs to `` XML definitions.
What, if anything, is done with this extra metadata is totally up to your own custom
@@ -716,9 +704,9 @@ as it stands).
<1> This is the example `meta` element
====
-In the case of the preceding example, you could assume that there is some logic that
-consumes the bean definition and sets up some caching infrastructure that uses the supplied
-metadata.
+In the case of the preceding example, you could assume that there is some logic that consumes
+the bean definition and sets up some caching infrastructure that uses the supplied metadata.
+
@@ -738,11 +726,11 @@ Spring distribution, you should first read the appendix entitled <>.
To create new XML configuration extensions:
-. <> an XML schema to describe your custom element(s).
-. <> a custom `NamespaceHandler` implementation.
-. <> one or more `BeanDefinitionParser` implementations
+. <> an XML schema to describe your custom element(s).
+. <> a custom `NamespaceHandler` implementation.
+. <> one or more `BeanDefinitionParser` implementations
(this is where the real work is done).
-. <> your new artifacts with Spring.
+. <> your new artifacts with Spring.
For a unified example, we create an
XML extension (a custom XML element) that lets us configure objects of the type
@@ -864,7 +852,7 @@ The `NamespaceHandler` interface features three methods:
* `BeanDefinitionHolder decorate(Node, BeanDefinitionHolder, ParserContext)`: Called
when Spring encounters an attribute or nested element of a different namespace.
The decoration of one or more bean definitions is used (for example) with the
- <>.
+ <>.
We start by highlighting a simple example, without using decoration, after which
we show decoration in a somewhat more advanced example.
@@ -964,6 +952,7 @@ is the extraction and setting of the bean definition's unique identifier.
[[xsd-custom-registration]]
=== Registering the Handler and the Schema
+
The coding is finished. All that remains to be done is to make the Spring XML
parsing infrastructure aware of our custom element. We do so by registering our custom
`namespaceHandler` and custom XSD file in two special-purpose properties files. These
@@ -973,7 +962,6 @@ XML parsing infrastructure automatically picks up your new extension by consumin
these special properties files, the formats of which are detailed in the next two sections.
-
[[xsd-custom-registration-spring-handlers]]
==== Writing `META-INF/spring.handlers`
@@ -996,7 +984,6 @@ namespace extension and needs to exactly match exactly the value of the `targetN
attribute, as specified in your custom XSD schema.
-
[[xsd-custom-registration-spring-schemas]]
==== Writing 'META-INF/spring.schemas'
@@ -1067,7 +1054,6 @@ in a Spring XML configuration file:
This section presents some more detailed examples of custom XML extensions.
-
[[xsd-custom-custom-nested]]
==== Nesting Custom Elements within Custom Elements
@@ -1135,7 +1121,6 @@ The following listing shows the `Component` class:
public void setName(String name) {
this.name = name;
}
-
}
----
====
@@ -1183,16 +1168,15 @@ setter property for the `components` property. The following listing shows such
public boolean isSingleton() {
return true;
}
-
}
----
====
-This works nicely, but it exposes a lot of Spring plumbing to the
-end user. What we are going to do is write a custom extension that hides away all of
-this Spring plumbing. If we stick to <>, we start off by creating the XSD schema to define the structure of our
-custom tag, as the following listing shows:
+This works nicely, but it exposes a lot of Spring plumbing to the end user. What we are
+going to do is write a custom extension that hides away all of this Spring plumbing.
+If we stick to <>, we start off
+by creating the XSD schema to define the structure of our custom tag, as the following
+listing shows:
====
[source,xml,indent=0]
@@ -1220,7 +1204,8 @@ custom tag, as the following listing shows:
----
====
-Again following <>, we then create a custom `NamespaceHandler`:
+Again following <>,
+we then create a custom `NamespaceHandler`:
====
[source,java,indent=0]
@@ -1235,14 +1220,13 @@ Again following <>, we th
public void init() {
registerBeanDefinitionParser("component", new ComponentBeanDefinitionParser());
}
-
}
----
====
Next up is the custom `BeanDefinitionParser`. Remember that we are creating
-`BeanDefinition` that describes a `ComponentFactoryBean`. The following listing shows our
-custom `BeanDefinitionParser`:
+a `BeanDefinition` that describes a `ComponentFactoryBean`. The following
+listing shows our custom `BeanDefinitionParser` implementation:
====
[source,java,indent=0]
@@ -1292,7 +1276,6 @@ custom `BeanDefinitionParser`:
}
factory.addPropertyValue("children", children);
}
-
}
----
====
@@ -1317,21 +1300,20 @@ http\://www.foo.com/schema/component/component.xsd=com/foo/component.xsd
====
-
[[xsd-custom-custom-just-attributes]]
==== Custom Attributes on "`Normal`" Elements
-Writing your own custom parser and the associated artifacts is not hard. However, it is sometimes
-not the right thing to do. Consider a scenario where you need to add metadata to
-already existing bean definitions. In this case, you certainly do not want to have to
-write your own entire custom extension. Rather, you merely want to add an
-additional attribute to the existing bean definition element.
+Writing your own custom parser and the associated artifacts is not hard. However,
+it is sometimes not the right thing to do. Consider a scenario where you need to
+add metadata to already existing bean definitions. In this case, you certainly
+do not want to have to write your own entire custom extension. Rather, you merely
+want to add an additional attribute to the existing bean definition element.
-By way of another example, suppose that you define a bean
-definition for a service object that (unknown to it) accesses a clustered
-http://jcp.org/en/jsr/detail?id=107[JCache], and you want to ensure that the named
-JCache instance is eagerly started within the surrounding cluster. The following
-listing shows such a definition:
+By way of another example, suppose that you define a bean definition for a
+service object that (unknown to it) accesses a clustered
+http://jcp.org/en/jsr/detail?id=107[JCache], and you want to ensure that the
+named JCache instance is eagerly started within the surrounding cluster.
+The following listing shows such a definition:
====
[source,xml,indent=0]
@@ -1367,13 +1349,12 @@ JCache-initializing `BeanDefinition`. The following listing shows our `JCacheIni
public void initialize() {
// lots of JCache API calls to initialize the named cache...
}
-
}
----
====
-Now we can move onto the custom extension. First, we need to author the XSD schema that describes the
-custom attribute, as follows:
+Now we can move onto the custom extension. First, we need to author
+the XSD schema that describes the custom attribute, as follows:
====
[source,xml,indent=0]
@@ -1413,9 +1394,9 @@ Next, we need to create the associated `NamespaceHandler`, as follows:
----
====
-Next, we need to create the parser. Note that, in this case, because we are going to parse an XML
-attribute, we write a `BeanDefinitionDecorator` rather than a `BeanDefinitionParser`.
-The following listing shows our `BeanDefinitionDecorator`:
+Next, we need to create the parser. Note that, in this case, because we are going to parse
+an XML attribute, we write a `BeanDefinitionDecorator` rather than a `BeanDefinitionParser`.
+The following listing shows our `BeanDefinitionDecorator` implementation:
====
[source,java,indent=0]
@@ -1470,7 +1451,6 @@ The following listing shows our `BeanDefinitionDecorator`:
}
return beanName;
}
-
}
----
====
diff --git a/src/docs/asciidoc/core/core-beans.adoc b/src/docs/asciidoc/core/core-beans.adoc
index dfcc1676c4..728b1c47d0 100644
--- a/src/docs/asciidoc/core/core-beans.adoc
+++ b/src/docs/asciidoc/core/core-beans.adoc
@@ -104,13 +104,13 @@ Spring IoC container.
NOTE: XML-based metadata is not the only allowed form of configuration metadata.
The Spring IoC container itself is totally decoupled from the format in which this
configuration metadata is actually written. These days, many developers choose
-<> for their Spring applications.
+<> for their Spring applications.
For information about using other forms of metadata with the Spring container, see:
* <>: Spring 2.5 introduced
support for annotation-based configuration metadata.
-* <>: Starting with Spring 3.0, many features
+* <>: Starting with Spring 3.0, many features
provided by the Spring JavaConfig project became part of the core Spring Framework.
Thus, you can define beans external to your application classes by using Java rather
than XML files. To use these new features, see the
@@ -265,7 +265,7 @@ XML configuration file represents a logical layer or module in your architecture
You can use the application context constructor to load bean definitions from all these
XML fragments. This constructor takes multiple `Resource` locations, as was shown in the
-<>. Alternatively, use one or more
+<>. Alternatively, use one or more
occurrences of the `` element to load bean definitions from another file or
files. The following example shows how to do so:
@@ -1024,8 +1024,8 @@ example shows:
Keep in mind that, to make this work out of the box, your code must be compiled with the
debug flag enabled so that Spring can look up the parameter name from the constructor.
-If you cannot or do not want to compile your code with the debug flag, you can use
-http://download.oracle.com/javase/6/docs/api/java/beans/ConstructorProperties.html[@ConstructorProperties]
+If you cannot or do not want to compile your code with the debug flag, you can use the
+http://download.oracle.com/javase/8/docs/api/java/beans/ConstructorProperties.html[@ConstructorProperties]
JDK annotation to explicitly name your constructor arguments. The sample class would
then have to look as follows:
@@ -1096,7 +1096,7 @@ load an entire Spring IoC container instance.
****
Since you can mix constructor-based and setter-based DI, it is a good rule of thumb to
use constructors for mandatory dependencies and setter methods or configuration methods
-for optional dependencies. Note that use of the <>
+for optional dependencies. Note that use of the <>
annotation on a setter method can be used to make the property be a required dependency;
however, constructor injection with programmatic validation of arguments is preferable.
@@ -1189,7 +1189,7 @@ to being injected into the dependent bean. This means that, if bean A has a depe
bean B, the Spring IoC container completely configures bean B prior to invoking the
setter method on bean A. In other words, the bean is instantiated (if it is not a
pre-instantiated singleton), its dependencies are set, and the relevant lifecycle
-methods (such as a <>
+methods (such as a <>
or the <>)
are invoked.
@@ -1358,7 +1358,7 @@ do not discuss those details here.
[[beans-factory-properties-detailed]]
=== Dependencies and Configuration in Detail
-As mentioned in the <>, you can define bean
+As mentioned in the <>, you can define bean
properties and constructor arguments as references to other managed beans (collaborators)
or as values defined inline. Spring's XML-based configuration metadata supports
sub-element types within its `` and `` elements for this
@@ -2195,11 +2195,11 @@ In the latter scenario, you have several options:
* Abandon autowiring in favor of explicit wiring.
* Avoid autowiring for a bean definition by setting its `autowire-candidate` attributes
- to `false`, as described in the <>.
+ to `false`, as described in the <>.
* Designate a single bean definition as the primary candidate by setting the
`primary` attribute of its `` element to `true`.
-* Implement the more fine-grained control available
- with annotation-based configuration, as described in <>.
+* Implement the more fine-grained control available with annotation-based configuration,
+ as described in <>.
@@ -2304,7 +2304,7 @@ https://spring.io/blog/2004/08/06/method-injection/[this blog entry].
Lookup method injection is the ability of the container to override methods on
container-managed beans and return the lookup result for another named bean in the
container. The lookup typically involves a prototype bean, as in the scenario described
-in <>. The Spring Framework
+in <>. The Spring Framework
implements this method injection by using bytecode generation from the CGLIB library to
dynamically generate a subclass that overrides the method.
@@ -3524,7 +3524,7 @@ configured with a different method name, then each configured method is executed
order listed after this note. However, if the same method name is configured -- for example,
`init()` for an initialization method -- for more than one of these lifecycle mechanisms,
that method is executed once, as explained in the
-<>.
+<>.
Multiple lifecycle mechanisms configured for the same bean, with different
initialization methods, are called as follows:
@@ -3789,7 +3789,7 @@ init-method.
[[aware-list]]
=== Other `Aware` Interfaces
-Besides `ApplicationContextAware` and `BeanNameAware` (discussed <>),
+Besides `ApplicationContextAware` and `BeanNameAware` (discussed <>),
Spring offers a wide range of `Aware` callback interfaces that let beans indicate to the container
that they require a certain infrastructure dependency. As a general rule, the name indicates the
dependency type. The following table summarizes the most important `Aware` interfaces:
@@ -4459,7 +4459,7 @@ while others argue that annotated classes are no longer POJOs and, furthermore,
configuration becomes decentralized and harder to control.
No matter the choice, Spring can accommodate both styles and even mix them together.
-It is worth pointing out that through its <> option, Spring lets
+It is worth pointing out that through its <> option, Spring lets
annotations be used in a non-invasive way, without touching the target components
source code and that, in terms of tooling, all configuration styles are supported by the
https://spring.io/tools/sts[Spring Tool Suite].
@@ -4864,7 +4864,7 @@ an `ApplicationContext` object:
[NOTE]
====
-The `@Autowired`, `@Inject`, `@Resource`, and `@Value` annotations are handled by Spring
+The `@Autowired`, `@Inject`, `@Value`, and `@Resource` annotations are handled by Spring
`BeanPostProcessor` implementations. This means that you cannot apply these annotations
within your own `BeanPostProcessor` or `BeanFactoryPostProcessor` types (if any).
These types must be 'wired up' explicitly by using XML or a Spring `@Bean` method.
@@ -5648,9 +5648,9 @@ supported as a marker for automatic exception translation in your persistence la
=== Using Meta-annotations and Composed Annotations
Many of the annotations provided by Spring can be used as meta-annotations in your
-own code. A meta-annotation is an annotation that can be applied to another
-annotation. For example, the `@Service` annotation mentioned <> is meta-annotated with
-`@Component`, as the following example shows:
+own code. A meta-annotation is an annotation that can be applied to another annotation.
+For example, the `@Service` annotation mentioned <>
+is meta-annotated with `@Component`, as the following example shows:
====
[source,java,indent=0]
@@ -5814,16 +5814,16 @@ TIP: The use of `` implicitly enables the functionality
====
The scanning of classpath packages requires the presence of corresponding directory
entries in the classpath. When you build JARs with Ant, make sure that you do not
-activate the files-only switch of the JAR task. Also, classpath directories may not
-be exposed based on security policies in some environments -- for example, standalone apps on
+activate the files-only switch of the JAR task. Also, classpath directories may not be
+exposed based on security policies in some environments -- for example, standalone apps on
JDK 1.7.0_45 and higher (which requires 'Trusted-Library' setup 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.
However, make sure that your component classes are exported in your `module-info`
descriptors. If you expect Spring to invoke non-public members of your classes, make
-sure that they are 'opened' (that is, that they use an `opens` declaration instead of an `exports`
-declaration in your `module-info` descriptor).
+sure that they are 'opened' (that is, that they use an `opens` declaration instead of an
+`exports` declaration in your `module-info` descriptor).
====
Furthermore, the `AutowiredAnnotationBeanPostProcessor` and
@@ -6855,7 +6855,7 @@ following example shows:
----
====
-NOTE: Remember that `@Configuration` classes are <>
+NOTE: Remember that `@Configuration` classes are <>
with `@Component`, so they are candidates for component-scanning. In the preceding example,
assuming that `AppConfig` is declared within the `com.acme` package (or any package
underneath), it is picked up during the call to `scan()`. Upon `refresh()`, all its `@Bean`
@@ -6935,8 +6935,8 @@ init-param):
`@Bean` is a method-level annotation and a direct analog of the XML `` element.
The annotation supports some of the attributes offered by ``, such as:
-* <>
-* <>
+* <>
+* <>
* <>
* `name`.
@@ -7048,7 +7048,7 @@ parameter, as the following example shows:
====
The resolution mechanism is pretty much identical to constructor-based dependency
-injection. See <> for more details.
+injection. See <> for more details.
[[beans-java-lifecycle-callbacks]]
@@ -7056,17 +7056,17 @@ injection. See <> for more det
Any classes defined with the `@Bean` annotation support the regular lifecycle callbacks
and can use the `@PostConstruct` and `@PreDestroy` annotations from JSR-250. See
-<> for further
+<> for further
details.
-The regular Spring <> callbacks are fully supported as
+The regular Spring <> callbacks are fully supported as
well. If a bean implements `InitializingBean`, `DisposableBean`, or `Lifecycle`, their
respective methods are called by the container.
-The standard set of `*Aware` interfaces (such as <>,
-<>,
-<>,
-<>, and so on) are also fully supported.
+The standard set of `*Aware` interfaces (such as <>,
+<>,
+<>,
+<>, and so on) are also fully supported.
The `@Bean` annotation supports specifying arbitrary initialization and destruction
callback methods, much like Spring XML's `init-method` and `destroy-method` attributes
@@ -7176,7 +7176,7 @@ Spring includes the `@Scope` annotation so that you can specify the scope of a b
You can specify that your beans defined with the `@Bean` annotation should have a
specific scope. You can use any of the standard scopes specified in the
-<> section.
+<> section.
The default scope is `singleton`, but you can override this with the `@Scope` annotation,
as the following example shows:
@@ -7201,14 +7201,15 @@ as the following example shows:
===== `@Scope` and `scoped-proxy`
Spring offers a convenient way of working with scoped dependencies through
-<>. The easiest way to create such
-a proxy when using the XML configuration is the `` element.
-Configuring your beans in Java with a `@Scope` annotation offers equivalent support with
-the `proxyMode` attribute. The default is no proxy (`ScopedProxyMode.NO`), but you can
-specify `ScopedProxyMode.TARGET_CLASS` or `ScopedProxyMode.INTERFACES`.
+<>. The easiest way to create
+such a proxy when using the XML configuration is the `` element.
+Configuring your beans in Java with a `@Scope` annotation offers equivalent support
+with the `proxyMode` attribute. The default is no proxy (`ScopedProxyMode.NO`),
+but you can specify `ScopedProxyMode.TARGET_CLASS` or `ScopedProxyMode.INTERFACES`.
If you port the scoped proxy example from the XML reference documentation (see
-<>) to our `@Bean` using Java, it resembles the following:
+<>) to our `@Bean` using Java,
+it resembles the following:
====
[source,java,indent=0]
@@ -7354,7 +7355,7 @@ by using plain `@Component` classes.
[[beans-java-method-injection]]
==== Lookup Method Injection
-As noted earlier, <> is an
+As noted earlier, <> is an
advanced feature that you should use rarely. It is useful in cases where a
singleton-scoped bean has a dependency on a prototype-scoped bean. Using Java for this
type of configuration provides a natural means for implementing this pattern. The
@@ -7552,7 +7553,7 @@ issue, because no compiler is involved, and you can declare
When using `@Configuration` classes, the Java compiler places constraints on
the configuration model, in that references to other beans must be valid Java syntax.
-Fortunately, solving this problem is simple. As <>,
+Fortunately, solving this problem is simple. As <>,
a `@Bean` method can have an arbitrary number of parameters that describe the bean
dependencies. Consider the following more real-world scenario with several `@Configuration`
classes, each depending on beans declared in the others:
@@ -8030,8 +8031,8 @@ jdbc.password=
The {api-spring-framework}/core/env/Environment.html[`Environment`] interface
is an abstraction integrated in the container that models two key
-aspects of the application environment: <>
-and <>.
+aspects of the application environment: <>
+and <>.
A profile is a named, logical group of bean definitions to be registered with the
container only if the given profile is active. Beans may be assigned to a profile
@@ -8174,7 +8175,7 @@ NOTE: You cannot mix the `&` and `|` operators without using parentheses. For ex
`production & us-east | eu-central` is not a valid expression. It must be expressed as
`production & (us-east | eu-central)`.
-You can use `@Profile` as a <> for the purpose
+You can use `@Profile` as a <> for the purpose
of creating a custom composed annotation. The following example defines a custom
`@Production` annotation that you can use as a drop-in replacement for
`@Profile("production")`:
@@ -8382,9 +8383,9 @@ In addition, you can also declaratively activate profiles through the
`spring.profiles.active` property, which may be specified through system environment
variables, JVM system properties, servlet context parameters in `web.xml`, or even as an
entry in JNDI (see <>). In integration tests, active
-profiles can be declared by using the `@ActiveProfiles` annotation in the `spring-test` module
-(see <>).
+profiles can be declared by using the `@ActiveProfiles` annotation in the `spring-test`
+module (see <>).
Note that profiles are not an "`either-or`" proposition. You can activate multiple
profiles at once. Programmatically, you can provide multiple profile names to the
@@ -8656,9 +8657,10 @@ Alternatively, for XML configuration, you can use the `context:load-time-weaver`
Once configured for the `ApplicationContext`, any bean within that `ApplicationContext`
may implement `LoadTimeWeaverAware`, thereby receiving a reference to the load-time
weaver instance. This is particularly useful in combination with
-<> where load-time weaving may be necessary
-for JPA class transformation.
-Consult the {api-spring-framework}/orm/jpa/LocalContainerEntityManagerFactoryBean.html[`LocalContainerEntityManagerFactoryBean`]
+<> 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 <>.
@@ -8667,7 +8669,7 @@ javadoc for more detail. For more on AspectJ load-time weaving, see <>, the `org.springframework.beans.factory`
+As discussed in the <>, the `org.springframework.beans.factory`
package provides basic functionality for managing and manipulating beans, including in a
programmatic way. The `org.springframework.context` package adds the
{api-spring-framework}/context/ApplicationContext.html[`ApplicationContext`]
@@ -8919,7 +8921,7 @@ class and the `ApplicationListener` interface. If a bean that implements the
Essentially, this is the standard Observer design pattern.
TIP: As of Spring 4.2, the event infrastructure has been significantly improved and offers
-an <> as well as the
+an <> as well as the
ability to publish any arbitrary event (that is, an object that does not necessarily
extend from `ApplicationEvent`). When such an object is published, we wrap it in an
event for you.
@@ -9149,12 +9151,12 @@ following example shows how to do so:
----
====
-It is also possible to add additional runtime filtering by using the `condition` attribute of the
-annotation that defines a <> , which should match to actually
-invoke the method for a particular event.
+It is also possible to add additional runtime filtering by using the `condition` attribute
+of the annotation that defines a <> , which should match
+to actually invoke the method for a particular event.
-The following example shows how our notifier can be rewritten to be invoked only if the `content` attribute
-of the event is equal to `my-event`:
+The following example shows how our notifier can be rewritten to be invoked only if the
+`content` attribute of the event is equal to `my-event`:
====
[source,java,indent=0]
@@ -9211,8 +9213,8 @@ method signature to return the event that should be published, as the following
----
====
-NOTE: This feature is not supported for <>.
+NOTE: This feature is not supported for
+<>.
This new method publishes a new `ListUpdateEvent` for every `BlackListEvent` handled by the
method above. If you need to publish several events, you can return a `Collection` of events
@@ -9223,8 +9225,8 @@ instead.
==== Asynchronous Listeners
If you want a particular listener to process events asynchronously, you can reuse the
-<>. The
-following example shows how to do so:
+<>.
+The following example shows how to do so:
====
[source,java,indent=0]
@@ -9243,8 +9245,9 @@ Be aware of the following limitations when using asynchronous events:
* If the event listener throws an `Exception`, it is not propagated to the caller
See `AsyncUncaughtExceptionHandler` for more details.
* Such event listener cannot send replies. If you need to send another event as the
- result of the processing, inject {api-spring-framework}/aop/interceptor/AsyncUncaughtExceptionHandler.html[`ApplicationEventPublisher`] to send the event
- manually.
+ result of the processing, inject
+ {api-spring-framework}/aop/interceptor/AsyncUncaughtExceptionHandler.html[`ApplicationEventPublisher`]
+ to send the event manually.
[[context-functionality-events-order]]
@@ -9320,9 +9323,8 @@ an event.
[[context-functionality-resources]]
=== Convenient Access to Low-level Resources
-For optimal usage and understanding of application contexts, you should
-familiarize yourself with Spring's `Resource` abstraction, as described in
-<>.
+For optimal usage and understanding of application contexts, you should familiarize
+yourself with Spring's `Resource` abstraction, as described in <>.
An application context is a `ResourceLoader`, which can be used to load `Resource` objects.
A `Resource` is essentially a more feature rich version of the JDK `java.net.URL` class.
@@ -9478,11 +9480,11 @@ by convention (that is, by bean name or by bean type -- in particular, post-proc
while a plain `DefaultListableBeanFactory` is agnostic about any special beans.
For many extended container features, such as annotation processing and AOP proxying,
-the <> is essential.
+the <> is essential.
If you use only a plain `DefaultListableBeanFactory`, such post-processors do not
get detected and activated by default. This situation could be confusing, because
-nothing is actually wrong with your bean configuration. Rather, in such a scenario, the
-container needs to be fully bootstrapped through additional setup.
+nothing is actually wrong with your bean configuration. Rather, in such a scenario,
+the container needs to be fully bootstrapped through additional setup.
The following table lists features provided by the `BeanFactory` and
`ApplicationContext` interfaces and implementations.
diff --git a/src/docs/asciidoc/core/core-databuffer-codec.adoc b/src/docs/asciidoc/core/core-databuffer-codec.adoc
index e23c07ebfd..0084ee7442 100644
--- a/src/docs/asciidoc/core/core-databuffer-codec.adoc
+++ b/src/docs/asciidoc/core/core-databuffer-codec.adoc
@@ -10,7 +10,7 @@ APIs as follows:
* <> abstracts the creation of a data buffer.
* <> represents a byte buffer, which may be
-<>.
+<>.
* <> offers utility methods for data buffers.
* <> decode or encode streams data buffer streams into higher level objects.
@@ -93,7 +93,6 @@ composite buffers, if that's supported by the underlying byte buffer API.
-
[[codecs]]
== Codecs
@@ -105,7 +104,7 @@ The `org.springframework.core.codec` package provides the following strategy int
The `spring-core` module provides `byte[]`, `ByteBuffer`, `DataBuffer`, `Resource`, and
`String` encoder and decoder implementations. The `spring-web` module adds Jackson JSON,
Jackson Smile, JAXB2, Protocol Buffers and other encoders and decoders. See
-<> in the WebFlux section.
+<> in the WebFlux section.
@@ -114,7 +113,7 @@ Jackson Smile, JAXB2, Protocol Buffers and other encoders and decoders. See
== Using `DataBuffer`
When working with data buffers, special care must be taken to ensure buffers are released
-since they may be <>. We'll use codecs to illustrate
+since they may be <>. We'll use codecs to illustrate
how that works but the concepts apply more generally. Let's see what codecs must do
internally to manage data buffers.
diff --git a/src/docs/asciidoc/core/core-expressions.adoc b/src/docs/asciidoc/core/core-expressions.adoc
index e420a02c73..bda0642768 100644
--- a/src/docs/asciidoc/core/core-expressions.adoc
+++ b/src/docs/asciidoc/core/core-expressions.adoc
@@ -10,8 +10,8 @@ While there are several other Java expression languages available -- OGNL, MVEL,
EL, to name a few -- the Spring Expression Language was created to provide the Spring
community with 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 Spring Tool Suite. That said,
+requirements of the projects in the Spring portfolio, including tooling requirements
+for code completion support within the Eclipse-based Spring Tool Suite. That said,
SpEL is based on a technology-agnostic API that lets other expression language
implementations be integrated, should the need arise.
@@ -20,14 +20,14 @@ portfolio, it is not directly tied to Spring and can be used independently. To
be self contained, many of the examples in this chapter use SpEL as if it were an
independent expression language. This requires creating a few bootstrapping
infrastructure classes, such as the parser. Most Spring users need not deal with
-this infrastructure and can, instead, author only expression strings for evaluation. An
-example of this typical use is the integration of SpEL into creating XML or annotation-based
-bean definitions, as shown in <>.
+this infrastructure and can, instead, author only expression strings for evaluation.
+An example of this typical use is the integration of SpEL into creating XML or
+annotation-based bean definitions, as shown in
+<>.
This chapter covers the features of the expression language, its API, and its language
-syntax. In several places, `Inventor` and `Society` classes are used as the
-target objects for expression evaluation. These class declarations and the data used to
+syntax. In several places, `Inventor` and `Society` classes are used as the target
+objects for expression evaluation. These class declarations and the data used to
populate them are listed at the end of the chapter.
The expression language supports the following functionality:
@@ -60,7 +60,7 @@ The expression language supports the following functionality:
This section introduces the simple use of SpEL interfaces and its expression language.
The complete language reference can be found in
-<>.
+<>.
The following code introduces the SpEL API to evaluate the literal string expression,
`Hello World`.
@@ -332,13 +332,14 @@ 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 (<>)
-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
+(<>) 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
-in the `org.springframework.expression.spel.SpelCompilerMode` enum. The modes are as follows:
+The compiler can operate in one of three modes, which are captured in the
+`org.springframework.expression.spel.SpelCompilerMode` enum. The modes are as follows:
* `OFF` (default): The compiler is switched off.
* `IMMEDIATE`: In immediate mode, the expressions are compiled as soon as possible. This
@@ -641,7 +642,7 @@ By default, real numbers are parsed by using Double.parseDouble().
Navigating with property references is easy. To do so, use a period to indicate a nested
property value. The instances of the `Inventor` class, `pupin` and `tesla`, were populated with
-data listed in the <> section.
+data listed in the <> section.
To navigate "`down`" and get Tesla's year of birth and Pupin's city of birth, we use the following
expressions:
diff --git a/src/docs/asciidoc/core/core-null-safety.adoc b/src/docs/asciidoc/core/core-null-safety.adoc
index 95b7ed82be..07044b6850 100644
--- a/src/docs/asciidoc/core/core-null-safety.adoc
+++ b/src/docs/asciidoc/core/core-null-safety.adoc
@@ -1,29 +1,31 @@
-[[null-safety]]
+[-[null-safety]]
= Null-safety
-Although Java does not let you express null-safety with its type system, Spring Framework
-now provides the following annotations in the `org.springframework.lang` package to let you declare
-nullability of APIs and fields:
+Although Java does not let you express null-safety with its type system, the Spring Framework
+now provides the following annotations in the `org.springframework.lang` package to let you
+declare nullability of APIs and fields:
-* {api-spring-framework}/lang/NonNull.html[`@NonNull`]: Annotation to indicate that a specific parameter,
-return value, or field cannot be `null` (not needed on parameter and return value
-where `@NonNullApi` and `@NonNullFields` apply) .
-* {api-spring-framework}/lang/Nullable.html[`@Nullable`]: Annotation to indicate that a specific
-parameter, return value, or field can be `null`.
+* {api-spring-framework}/lang/Nullable.html[`@Nullable`]: Annotation to indicate that a
+specific parameter, return value, or field can be `null`.
+* {api-spring-framework}/lang/NonNull.html[`@NonNull`]: Annotation to indicate that a specific
+parameter, return value, or field cannot be `null` (not needed on parameters / return values
+and fields where `@NonNullApi` and `@NonNullFields` apply, respectively).
* {api-spring-framework}/lang/NonNullApi.html[`@NonNullApi`]: Annotation at the package level
-that declares non-null as the default behavior for parameters and return values.
+that declares non-null as the default semantics for parameters and return values.
* {api-spring-framework}/lang/NonNullFields.html[`@NonNullFields`]: Annotation at the package
-level that declares non-null as the default behavior for fields.
+level that declares non-null as the default semantics for fields.
-Spring Framework leverages itself these annotations, but they can also be used in any Spring based
-Java project to declare null-safe APIs and optionally null-safe fields. Generic type arguments,
-varargs and array elements nullability are not supported yet, but should be in an upcoming
-release, see https://jira.spring.io/browse/SPR-15942[SPR-15942] for up-to-date information.
-Nullability declaration are expected to be fine-tuned between Spring Framework release,
-including minor ones. Nullability of types used inside method bodies is outside of the
-scope of this feature.
+The Spring Framework itself leverages these annotations, but they can also be used in any
+Spring-based Java project to declare null-safe APIs and optionally null-safe fields.
+Generic type arguments, varargs and array elements nullability are not supported yet but
+should be in an upcoming release, see https://jira.spring.io/browse/SPR-15942[SPR-15942]
+for up-to-date information. Nullability declarations are expected to be fine-tuned between
+Spring Framework releases, including minor ones. Nullability of types used inside method
+bodies is outside of the scope of this feature.
-NOTE: Libraries like Reactor or Spring Data provide null-safe APIs that use this feature.
+NOTE: Other common libraries such as Reactor and Spring Data provide null-safe APIs that
+use a similar nullability arrangement, delivering a consistent overall experience for
+Spring application developers.
@@ -32,25 +34,23 @@ NOTE: Libraries like Reactor or Spring Data provide null-safe APIs that use this
In addition to providing an explicit declaration for Spring Framework API nullability,
these annotations can be used by an IDE (such as IDEA or Eclipse) to provide useful
-warnings related to null-safety in order to avoid `NullPointerException`
-at runtime.
+warnings related to null-safety in order to avoid `NullPointerException` at runtime.
They are also used to make Spring API null-safe in Kotlin projects, since Kotlin natively
supports https://kotlinlang.org/docs/reference/null-safety.html[null-safety]. More details
-are available in the <>.
+are available in the <>.
-== JSR 305 meta-annotations
+== JSR-305 meta-annotations
Spring annotations are meta-annotated with https://jcp.org/en/jsr/detail?id=305[JSR 305]
-annotations (a dormant but widely spread JSR). JSR 305 meta-annotations let tooling vendors
-like IDEA or Kotlin provide null-safety support in a generic way, without having to hard-code
-support for Spring annotations.
+annotations (a dormant but wide-spread JSR). JSR-305 meta-annotations let tooling vendors
+like IDEA or Kotlin provide null-safety support in a generic way, without having to
+hard-code support for Spring annotations.
-It is not necessary nor recommended to add JSR 305 dependency in the project classpath to
-take advantage of Spring null-safe API. Only projects such as
-Spring-based libraries that use null-safety annotations in their codebase should add
-`com.google.code.findbugs:jsr305:3.0.2` with `compileOnly` Gradle configuration or Maven
-`provided` scope to avoid compile warnings.
+It is not necessary nor recommended to add a JSR-305 dependency to the project classpath to
+take advantage of Spring null-safe API. Only projects such as Spring-based libraries that use
+null-safety annotations in their codebase should add `com.google.code.findbugs:jsr305:3.0.2`
+with `compileOnly` Gradle configuration or Maven `provided` scope to avoid compile warnings.
diff --git a/src/docs/asciidoc/core/core-resources.adoc b/src/docs/asciidoc/core/core-resources.adoc
index 4d5c651aa7..4c9fcc1dbe 100644
--- a/src/docs/asciidoc/core/core-resources.adoc
+++ b/src/docs/asciidoc/core/core-resources.adoc
@@ -351,10 +351,10 @@ interface if that is all you need. The code would be coupled only to the resourc
interface (which can be considered a utility interface) and not to the whole Spring
`ApplicationContext` interface.
-As of Spring 2.5, you can rely upon autowiring of the `ResourceLoader` as an alternative
-to implementing the `ResourceLoaderAware` interface. The "`traditional`" `constructor` and
-`byType` autowiring modes (as described in <>) are now capable of
-providing a dependency of type `ResourceLoader` for either a constructor argument or a
+In application components, you may also rely upon autowiring of the `ResourceLoader` as
+an alternative to implementing the `ResourceLoaderAware` interface. The "`traditional`"
+`constructor` and `byType` autowiring modes (as described in <>)
+are capable of providing a `ResourceLoader` for either a constructor argument or a
setter method parameter, respectively. For more flexibility (including the ability to
autowire fields and multiple parameter methods), consider using the annotation-based
autowiring features. In that case, the `ResourceLoader` is autowired into a field,
diff --git a/src/docs/asciidoc/core/core-validation.adoc b/src/docs/asciidoc/core/core-validation.adoc
index 05bb896d47..8b749accf2 100644
--- a/src/docs/asciidoc/core/core-validation.adoc
+++ b/src/docs/asciidoc/core/core-validation.adoc
@@ -20,18 +20,19 @@ directly. Because this is reference documentation, however, we felt that some ex
might be in order. We explain the `BeanWrapper` in this chapter, since, if you are
going to use it at all, you are most likely do so when trying to bind data to objects.
-Spring's `DataBinder` and the lower-level `BeanWrapper` both use `PropertyEditorSupport` implementations to parse
-and format property values. The `PropertyEditor` and `PropertyEditorSupport` interfaces are part of the JavaBeans
-specification and are also explained in this chapter. Spring 3 introduced a
-`core.convert` package that provides a general type conversion facility, as well as a
-higher-level "`format`" package for formatting UI field values. You can use these packages
-as simpler alternatives to `PropertyEditorSupport` implementations. They are also discussed in this
-chapter.
+Spring's `DataBinder` and the lower-level `BeanWrapper` both use `PropertyEditorSupport`
+implementations to parse and format property values. The `PropertyEditor` and
+`PropertyEditorSupport` types are part of the JavaBeans specification and are also
+explained in this chapter. Spring 3 introduced a `core.convert` package that provides a
+general type conversion facility, as well as a higher-level "`format`" package for
+formatting UI field values. You can use these packages as simpler alternatives to
+`PropertyEditorSupport` implementations. They are also discussed in this chapter.
.JSR-303/JSR-349 Bean Validation
****
-As of version 4.0, Spring Framework supports Bean Validation 1.0 (JSR-303) and Bean Validation 1.1
-(JSR-349) for setup support and adapting them to Spring's `Validator` interface.
+As of version 4.0, Spring Framework supports Bean Validation 1.0 (JSR-303) and
+Bean Validation 1.1 (JSR-349) for setup support and adapting them to Spring's
+`Validator` interface.
An application can choose to enable Bean Validation once globally, as described in
<>, and use it exclusively for all validation needs.
@@ -173,22 +174,21 @@ methods it offers can be found in the {api-spring-framework}validation/Errors.ht
[[validation-conversion]]
== Resolving Codes to Error Messages
-We covered databinding and validation. This section covers outputting messages that correspond to
-validation errors. In the example shown in the <>,
-we rejected the `name` and `age` fields. If we want to output the error
-messages by using a `MessageSource`, we can do so using the error code we provide when
-rejecting the field ('name' and 'age' in this case). When you call (either directly, or
-indirectly, by using, for example, the `ValidationUtils` class) `rejectValue` or one of the
-other `reject` methods from the `Errors` interface, the underlying implementation
-not only registers the code you passed in but also registers a number of additional error
-codes. The `MessageCodesResolver` determines which error codes the `Errors` interface registers.
-By default, the `DefaultMessageCodesResolver` is used, which (for example) not only
-registers a message with the code you gave but also registers messages that include the field
-name you passed to the reject method. So, if you reject a field by using
-`rejectValue("age", "too.darn.old")`, apart from the `too.darn.old` code, Spring
-also registers `too.darn.old.age` and `too.darn.old.age.int` (the first includes
-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.
+We covered databinding and validation. This section covers outputting messages that correspond
+to validation errors. In the example shown in the <>,
+we rejected the `name` and `age` fields. If we want to output the error messages by using a
+`MessageSource`, we can do so using the error code we provide when rejecting the field
+('name' and 'age' in this case). When you call (either directly, or indirectly, by using,
+for example, the `ValidationUtils` class) `rejectValue` or one of the other `reject` methods
+from the `Errors` interface, the underlying implementation not only registers the code you
+passed in but also registers a number of additional error codes. The `MessageCodesResolver`
+determines which error codes the `Errors` interface registers. By default, the
+`DefaultMessageCodesResolver` is used, which (for example) not only registers a message
+with the code you gave but also registers messages that include the field name you passed
+to the reject method. So, if you reject a field by using `rejectValue("age", "too.darn.old")`,
+apart from the `too.darn.old` code, Spring also registers `too.darn.old.age` and
+`too.darn.old.age.int` (the first includes 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
@@ -259,8 +259,8 @@ object. The following table shows some examples of these conventions:
(This next section is not vitally important to you if you do not plan to work with
the `BeanWrapper` directly. If you use only the `DataBinder` and the `BeanFactory`
-and their default implementations, you should skip ahead to the <>.)
+and their default implementations, you should skip ahead to the
+<>.)
The following two example classes use the `BeanWrapper` to get and set
properties:
@@ -537,17 +537,17 @@ where it can be automatically detected and applied.
Note that all bean factories and application contexts automatically use a number of
built-in property editors, through their use a `BeanWrapper` to
handle property conversions. The standard property editors that the `BeanWrapper`
-registers are listed in <>. Additionally,
-`ApplicationContexts` also override or add additional editors to handle
+registers are listed in the <>.
+Additionally, `ApplicationContexts` also override or add additional editors to handle
resource lookups in a manner appropriate to the specific application context type.
Standard JavaBeans `PropertyEditor` instances are used to convert property values
-expressed as strings to the actual complex type of the property.
-You can use `CustomEditorConfigurer`, a bean factory post-processor, to conveniently add
+expressed as strings to the actual complex type of the property. You can use
+`CustomEditorConfigurer`, a bean factory post-processor, to conveniently add
support for additional `PropertyEditor` instances to an `ApplicationContext`.
-Consider the following example, which defines a user class called `ExoticType` and another class called `DependsOnExoticType`, which needs
-`ExoticType` set as a property:
+Consider the following example, which defines a user class called `ExoticType` and
+another class called `DependsOnExoticType`, which needs `ExoticType` set as a property:
====
[source,java,indent=0]
@@ -629,14 +629,15 @@ Finally, the following example shows how to use `CustomEditorConfigurer` to regi
Another mechanism for registering property editors with the Spring container is to
create and use a `PropertyEditorRegistrar`. This interface is particularly useful when
-you need to use the same set of property editors in several different situations. You can write
-a corresponding registrar and reuse it in each case. `PropertyEditorRegistrar` instances work
-in conjunction with an interface called `PropertyEditorRegistry`, an interface that is
-implemented by the Spring `BeanWrapper` (and `DataBinder`). `PropertyEditorRegistrar` instances
-are particularly convenient when used in conjunction with `CustomEditorConfigurer`
-(described <>), which exposes a
-property called `setPropertyEditorRegistrars(..)`. `PropertyEditorRegistrar` instances added to a
-`CustomEditorConfigurer` in this fashion can easily be shared with `DataBinder` and
+you need to use the same set of property editors in several different situations.
+You can write a corresponding registrar and reuse it in each case.
+`PropertyEditorRegistrar` instances work in conjunction with an interface called
+`PropertyEditorRegistry`, an interface that is implemented by the Spring `BeanWrapper`
+(and `DataBinder`). `PropertyEditorRegistrar` instances are particularly convenient
+when used in conjunction with `CustomEditorConfigurer` (described
+<>), which exposes a property
+called `setPropertyEditorRegistrars(..)`. `PropertyEditorRegistrar` instances added
+to a `CustomEditorConfigurer` in this fashion can easily be shared with `DataBinder` and
Spring MVC controllers. Furthermore, it avoids the need for synchronization on custom
editors: A `PropertyEditorRegistrar` is expected to create fresh `PropertyEditor`
instances for each bean creation attempt.
@@ -687,7 +688,7 @@ The next example shows how to configure a `CustomEditorConfigurer` and inject an
====
Finally (and in a bit of a departure from the focus of this chapter for those of you
-using <>), using `PropertyEditorRegistrars` in
+using <>), using `PropertyEditorRegistrars` in
conjunction with data-binding `Controllers` (such as `SimpleFormController`) can be very
convenient. The following example uses a `PropertyEditorRegistrar` in the
implementation of an `initBinder(..)` method:
@@ -1002,8 +1003,7 @@ It is also common to use a `ConversionService` within a Spring MVC application.
<> in the Spring MVC chapter.
In certain situations, you may wish to apply formatting during conversion. See
-<> for details on using
-`FormattingConversionServiceFactoryBean`.
+<> for details on using `FormattingConversionServiceFactoryBean`.
diff --git a/src/docs/asciidoc/data-access-appendix.adoc b/src/docs/asciidoc/data-access-appendix.adoc
index f9aaaff040..bf8e61d851 100644
--- a/src/docs/asciidoc/data-access-appendix.adoc
+++ b/src/docs/asciidoc/data-access-appendix.adoc
@@ -18,7 +18,7 @@ This part of the appendix lists XML schemas for data access, including the follo
The `tx` tags deal with configuring all of those beans in Spring's comprehensive support
for transactions. These tags are covered in the chapter entitled
-<>.
+<>.
TIP: We strongly encourage you to look at the `'spring-tx.xsd'` file that ships with the
Spring distribution. This file contains the XML Schema for Spring's transaction
@@ -67,8 +67,8 @@ to you.
The `jdbc` elements let you quickly configure an embedded database or initialize an
existing data source. These elements are documented in
-<> and
-<>, respectively.
+<> and
+<>, respectively.
To use the elements in the `jdbc` schema, you need to have the following preamble at the
top of your Spring XML configuration file. The text in the following snippet references
diff --git a/src/docs/asciidoc/data-access.adoc b/src/docs/asciidoc/data-access.adoc
index 51147d1770..9583e6ea1b 100644
--- a/src/docs/asciidoc/data-access.adoc
+++ b/src/docs/asciidoc/data-access.adoc
@@ -26,33 +26,34 @@ management that delivers the following benefits:
* A consistent programming model across different transaction APIs, such as Java
Transaction API (JTA), JDBC, Hibernate, and the Java Persistence API (JPA).
-* Support for <>.
-* A simpler API for <> transaction management than
- complex transaction APIs, such as JTA.
+* Support for <>.
+* A simpler API for <> transaction management
+ than complex transaction APIs, such as JTA.
* Excellent integration with Spring's data access abstractions.
The following sections describe the Spring Framework's transaction features and
technologies:
-* <> describes why you would use the Spring Framework's transaction abstraction
instead of EJB Container-Managed Transactions (CMT) or choosing to drive local
transactions through a proprietary API, such as Hibernate.
-* <>
+* <>
outlines the core classes and describes how to configure and obtain `DataSource`
instances from a variety of sources.
-* <> describes
+* <> describes
how the application code ensures that resources are created, reused, and cleaned up
properly.
-* <> describes support for
+* <> describes support for
declarative transaction management.
-* <> covers support for
+* <> covers support for
programmatic (that is, explicitly coded) transaction management.
-* <> describes how you could use application
+* <> describes how you could use application
events within a transaction.
-(The chapter also includes discussions of best practices, <>, and <>.)
+The chapter also includes discussions of best practices,
+<>,
+and <>.
@@ -169,7 +170,7 @@ strategy. A transaction strategy is defined by the
====
This is primarily a service provider interface (SPI), although you can use it
-<> from your application code. Because
+<> from your application code. Because
`PlatformTransactionManager` is an interface, it can be easily mocked or stubbed as
necessary. It is not tied to a lookup strategy, such as JNDI.
`PlatformTransactionManager` implementations are defined like any other object (or bean)
@@ -311,8 +312,8 @@ The `JtaTransactionManager` does not need to know about the `DataSource` (or any
specific resources) because it uses the container's global transaction management
infrastructure.
-NOTE: The preceding definition of the `dataSource` bean uses the `` tag from the
-`jee` namespace. For more information see
+NOTE: The preceding definition of the `dataSource` bean uses the `` tag
+from the `jee` namespace. For more information see
<>.
You can also use easily Hibernate local transactions, as shown in the following
@@ -322,9 +323,9 @@ which your application code can use to obtain Hibernate `Session` instances.
The `DataSource` bean definition is similar to the local JDBC example shown
previously and, thus, is not shown in the following example.
-NOTE: If the `DataSource` (used by any non-JTA transaction manager) is looked up through JNDI and
-managed by a Java EE container, it should be non-transactional, because the Spring
-Framework (rather than the Java EE container) manages the transactions.
+NOTE: If the `DataSource` (used by any non-JTA transaction manager) is looked up through
+JNDI and managed by a Java EE container, it should be non-transactional, because the
+Spring Framework (rather than the Java EE container) manages the transactions.
The `txManager` bean in this case is of the `HibernateTransactionManager` type. In the
same way as the `DataSourceTransactionManager` needs a reference to the `DataSource`,
@@ -486,7 +487,7 @@ necessary. The differences between the two types of transaction management are:
* You can apply the Spring Framework declarative transaction management to any class,
not merely special classes such as EJBs.
* The Spring Framework offers declarative
- <>, a feature with no EJB
+ <>, a feature with no EJB
equivalent. Both programmatic and declarative support for rollback rules is provided.
* The Spring Framework lets you customize transactional behavior by using AOP.
For example, you can insert custom behavior in the case of transaction rollback. You
@@ -498,16 +499,6 @@ necessary. The differences between the two types of transaction management are:
recommend that you use EJB. However, consider carefully before using such a feature,
because, normally, one does not want transactions to span remote calls.
-.Where is TransactionProxyFactoryBean?
-****
-Declarative transaction configuration in versions of Spring 2.0 and above differs
-considerably from previous versions of Spring. The main difference is that there is no
-longer any need to configure `TransactionProxyFactoryBean` beans.
-
-The pre-Spring 2.0 configuration style is still 100% valid configuration. Think of the
-new `` as defining `TransactionProxyFactoryBean` beans on your behalf.
-****
-
The concept of rollback rules is important. They let you specify which exceptions
(and throwables) should cause automatic rollback. You can specify this declaratively, in
configuration, not in Java code. So, although you can still call `setRollbackOnly()` on
@@ -536,7 +527,7 @@ transaction infrastructure in the event of transaction-related issues.
The most important concepts to grasp with regard to the Spring Framework's declarative
transaction support are that this support is enabled
-<> and that the transactional
+<> and that the transactional
advice is driven by metadata (currently XML- or annotation-based). The combination of
AOP with transactional metadata yields an AOP proxy that uses a `TransactionInterceptor`
in conjunction with an appropriate `PlatformTransactionManager` implementation to drive
@@ -693,13 +684,14 @@ attribute explicitly, as in the preceding example.
The `` definition ensures that the transactional advice defined by the
`txAdvice` bean executes at the appropriate points in the program. First, you define a
-pointcut that matches the execution of any operation defined in the `FooService`
-interface ( `fooServiceOperation`). Then you associate the pointcut with the `txAdvice`
-by using an advisor. The result indicates that, at the execution of a `fooServiceOperation`,
+pointcut that matches the execution of any operation defined in the `FooService` interface
+(`fooServiceOperation`). Then you associate the pointcut with the `txAdvice` by using an
+advisor. The result indicates that, at the execution of a `fooServiceOperation`,
the advice defined by `txAdvice` is run.
The expression defined within the `` element is an AspectJ pointcut
-expression. See <> for more details on pointcut expressions in Spring.
+expression. See <> for more details on pointcut
+expressions in Spring.
A common requirement is to make an entire service layer transactional. The best way to
do this is to change the pointcut expression to match any operation in your
@@ -716,18 +708,18 @@ service layer. The following example shows how to do so:
----
====
-NOTE: In the preceding example, it is assumed that all your service interfaces are defined in the
-`x.y.service` package. See <> for more details.
+NOTE: In the preceding example, it is assumed that all your service interfaces are defined
+in the `x.y.service` package. See <> for more details.
Now that we have analyzed the configuration, you may be asking yourself,
"`What does all this configuration actually do?`"
The configuration shown earlier is used to create a transactional proxy around the object
that is created from the `fooService` bean definition. The proxy is configured with
-the transactional advice so that, when an appropriate method is invoked on the
-proxy, a transaction is started, suspended, marked as read-only, and so on, depending
-on the transaction configuration associated with that method. Consider the following
-program that test drives the configuration shown earlier:
+the transactional advice so that, when an appropriate method is invoked on the proxy,
+a transaction is started, suspended, marked as read-only, and so on, depending on the
+transaction configuration associated with that method. Consider the following program
+that test drives the configuration shown earlier:
====
[source,java,indent=0]
@@ -1007,7 +999,7 @@ transactional settings:
This section summarizes the various transactional settings that you can specify by using
the `` tag. The default `` settings are:
-* The <> is `REQUIRED.`
+* The <> is `REQUIRED.`
* The isolation level is `DEFAULT.`
* The transaction is read-write.
* The transaction timeout defaults to the default timeout of the underlying transaction
@@ -1225,7 +1217,7 @@ modified) to turn `@Transactional` into runtime behavior on any kind of method.
for classes annotated with the `@Transactional` annotation. If the
`proxy-target-class` attribute is set to `true`, class-based proxies are created.
If `proxy-target-class` is `false` or if the attribute is omitted, then standard JDK
- interface-based proxies are created. (See <>
+ interface-based proxies are created. (See <>
for a detailed examination of the different proxy types.)
| `order`
@@ -1233,7 +1225,7 @@ modified) to turn `@Transactional` into runtime behavior on any kind of method.
| `Ordered.LOWEST_PRECEDENCE`
| Defines the order of the transaction advice that is applied to beans annotated with
`@Transactional`. (For more information about the rules related to ordering of AOP
- advice, see <>.)
+ advice, see <>.)
No specified ordering means that the AOP subsystem determines the order of the advice.
|===
@@ -1404,7 +1396,7 @@ specifically qualified `PlatformTransactionManager` bean is found.
===== Custom Shortcut Annotations
If you find you repeatedly use the same attributes with `@Transactional` on many different
-methods, <> lets you
+methods, <> lets you
define custom shortcut annotations for your specific use cases. For example, consider the
following annotation definitions:
@@ -2588,7 +2580,7 @@ The following example invokes a stored procedure:
----
====
-More sophisticated stored procedure support is <>.
+More sophisticated stored procedure support is <>.
[[jdbc-JdbcTemplate-idioms]]
===== `JdbcTemplate` Best Practices
@@ -2600,7 +2592,7 @@ The `JdbcTemplate` is stateful, in that it maintains a reference to a `DataSourc
this state is not conversational state.
A common practice when using the `JdbcTemplate` class (and the associated
-<> class) is to
+<> class) is to
configure a `DataSource` in your Spring configuration file and then dependency-inject
that shared `DataSource` bean into your DAO classes. The `JdbcTemplate` is created in
the setter for the `DataSource`. This leads to DAOs that resemble the following:
@@ -3911,7 +3903,7 @@ returned `out` parameters.
Earlier in this chapter, we described how parameters are deduced from metadata, but you can declare them
explicitly if you wish. You can do so by creating and configuring `SimpleJdbcCall` with
the `declareParameters` method, which takes a variable number of `SqlParameter` objects
-as input. See the <> for details on how to define an `SqlParameter`.
+as input. See the <> for details on how to define an `SqlParameter`.
NOTE: Explicit declarations are necessary if the database you use is not a Spring-supported
database. Currently, Spring supports metadata lookup of stored procedure calls for the
@@ -4901,12 +4893,12 @@ call the `setType(EmbeddedDatabaseType)` method with `EmbeddedDatabaseType.DERBY
Embedded databases provide a lightweight way to test data access code. The next example is a
data access integration test template that uses an embedded database. Using such a template
-can be useful for one-offs when the embedded database does not need to be
-reused across test classes. However, if you wish to create an embedded database that is
-shared within a test suite, consider using the <> and configuring the embedded database as a bean in the Spring
-`ApplicationContext` as described in <> and
-<>. The following listing shows the test template:
+can be useful for one-offs when the embedded database does not need to be reused across test
+classes. However, if you wish to create an embedded database that is shared within a test suite,
+consider using the <> and
+configuring the embedded database as a bean in the Spring `ApplicationContext` as described
+in <> and <>. The following listing
+shows the test template:
====
[source,java,indent=0]
@@ -5202,14 +5194,13 @@ The benefits of using the Spring Framework to create your ORM DAOs include:
aspect-oriented programming (AOP) style method interceptor either through the
`@Transactional` annotation or by explicitly configuring the transaction AOP advice in
an XML configuration file. In both cases, transaction semantics and exception handling
- (rollback and so on) are handled for you. As discussed in
- <>, you can also swap various
- transaction managers, without affecting your ORM-related code. For example, you can
- swap between local transactions and JTA, with the same full services (such as
- declarative transactions) available in both scenarios. Additionally, JDBC-related code
- can fully integrate transactionally with the code you use to do ORM. This is useful
- for data access that is not suitable for ORM (such as batch processing and BLOB
- streaming) but that still needs to share common transactions with ORM operations.
+ (rollback and so on) are handled for you. As discussed in <>,
+ you can also swap various transaction managers, without affecting your ORM-related code.
+ For example, you can swap between local transactions and JTA, with the same full services
+ (such as declarative transactions) available in both scenarios. Additionally,
+ JDBC-related code can fully integrate transactionally with the code you use to do ORM.
+ This is useful for data access that is not suitable for ORM (such as batch processing and
+ BLOB streaming) but that still needs to share common transactions with ORM operations.
TIP: For more comprehensive ORM support, including support for alternative database
technologies such as MongoDB, you might want to check out the
@@ -5222,8 +5213,8 @@ Data with JPA] guide from https://spring.io provides a great introduction.
[[orm-general]]
=== General ORM Integration Considerations
-This section highlights considerations that apply to all ORM technologies. The
-<> section provides more details and also show these features and
+This section highlights considerations that apply to all ORM technologies.
+The <> section provides more details and also show these features and
configurations in a concrete context.
The major goal of Spring's ORM integration is clear application layering (with any data
@@ -5252,10 +5243,11 @@ interceptors for the ORM technologies.
The infrastructure provides proper resource handling and appropriate conversion of
specific API exceptions to an unchecked infrastructure exception hierarchy. Spring
introduces a DAO exception hierarchy, applicable to any data access strategy. For direct
-JDBC, the `JdbcTemplate` class mentioned in a <> provides connection
-handling and proper conversion of `SQLException` to the `DataAccessException` hierarchy,
-including translation of database-specific SQL error codes to meaningful exception
-classes. For ORM technologies, see the <> for how to get the same exception
+JDBC, the `JdbcTemplate` class mentioned in a <>
+provides connection handling and proper conversion of `SQLException` to the
+`DataAccessException` hierarchy, including translation of database-specific SQL error
+codes to meaningful exception classes. For ORM technologies, see the
+<> for how to get the same exception
translation benefits.
When it comes to transaction management, the `JdbcTemplate` class hooks in to the Spring
@@ -5342,7 +5334,7 @@ To avoid tying application objects to hard-coded resource lookups, you can defin
resources (such as a JDBC `DataSource` or a Hibernate `SessionFactory`) as beans in the
Spring container. Application objects that need to access resources receive references
to such predefined instances through bean references, as illustrated in the DAO
-definition in the <>.
+definition in the <>.
The following excerpt from an XML application context definition shows how to set up a
JDBC `DataSource` and a Hibernate `SessionFactory` on top of it:
@@ -5410,7 +5402,7 @@ property. On the programmatic `LocalSessionFactoryBuilder`, there is an overload
As of Spring Framework 5.1, such a native Hibernate setup can also expose a JPA
`EntityManagerFactory` for standard JPA interaction next to native Hibernate access.
-See <> for details.
+See <> for details.
====
@@ -5898,7 +5890,7 @@ NOTE: If you want to specifically configure a Hibernate setup, an immediate alte
to go with Hibernate 5.2 or 5.3 and set up a native Hibernate `LocalSessionFactoryBean`
instead of a plain JPA `LocalContainerEntityManagerFactoryBean`, letting it interact
with JPA access code as well as native Hibernate access code.
-See <> for details.
+See <> for details.
The `LocalContainerEntityManagerFactoryBean` gives full control over
`EntityManagerFactory` configuration and is appropriate for environments where
@@ -5984,18 +5976,17 @@ Spring provides a number of `LoadTimeWeaver` implementations for various environ
letting `ClassTransformer` instances be applied only for each class loader and not
for each VM.
-See <> in the AOP chapter for
+See the <> in the AOP chapter for
more insight regarding the `LoadTimeWeaver` implementations and their setup, either
-generic or customized to various platforms (such as Tomcat, WebLogic, GlassFish,
-Resin, and JBoss).
+generic or customized to various platforms (such as Tomcat, JBoss and WebSphere).
-As described in <>, you can configure a context-wide
-`LoadTimeWeaver` by using the `@EnableLoadTimeWeaving` annotation of the
-`context:load-time-weaver` XML element. Such a global weaver is automatically picked up by all JPA
-`LocalContainerEntityManagerFactoryBean` instances. The following example shows the preferred way of
-setting up a load-time weaver, delivering auto-detection of the platform (WebLogic,
-GlassFish, Tomcat, Resin, JBoss, or VM agent) and automatic propagation of the weaver to
-all weaver-aware beans:
+As described in <>, you can configure
+a context-wide `LoadTimeWeaver` by using the `@EnableLoadTimeWeaving` annotation of the
+`context:load-time-weaver` XML element. Such a global weaver is automatically picked u
+by all JPA `LocalContainerEntityManagerFactoryBean` instances. The following example
+shows the preferred way of setting up a load-time weaver, delivering auto-detection
+of the platform (e.g. Tomcat's weaving-capable class loader or Spring's JVM agent)
+and automatic propagation of the weaver to all weaver-aware beans:
====
[source,xml,indent=0]
@@ -6237,8 +6228,8 @@ Even though the new DAO implementation uses method-level
injection of an `EntityManager` instead of an `EntityManagerFactory`, no change is
required in the application context XML, due to annotation usage.
-The main advantage of this DAO style is that it depends only on the Java Persistence API. No
-import of any Spring class is required. Moreover, as the JPA annotations are understood,
+The main advantage of this DAO style is that it depends only on the Java Persistence API.
+No import of any Spring class is required. Moreover, as the JPA annotations are understood,
the injections are applied automatically by the Spring container. This is appealing from
a non-invasiveness perspective and can feel more natural to JPA developers.
@@ -6246,8 +6237,8 @@ a non-invasiveness perspective and can feel more natural to JPA developers.
[[orm-jpa-tx]]
==== Spring-driven JPA transactions
-NOTE: We strongly encourage you to read <>, if you have not already done
-so, to get more detailed coverage of Spring's declarative transaction support.
+NOTE: We strongly encourage you to read <>, if you have not
+already done so, to get more detailed coverage of Spring's declarative transaction support.
The recommended strategy for JPA is local transactions through JPA's native transaction
support. Spring's `JpaTransactionManager` provides many capabilities known from local
@@ -6258,13 +6249,13 @@ Spring JPA also lets a configured `JpaTransactionManager` expose a JPA transacti
to JDBC access code that accesses the same `DataSource`, provided that the registered
`JpaDialect` supports retrieval of the underlying JDBC `Connection`.
Spring provides dialects for the EclipseLink and Hibernate JPA implementations.
-See the <> for details on the `JpaDialect` mechanism.
+See the <> for details on the `JpaDialect` mechanism.
NOTE: As an immediate alternative, Spring's native `HibernateTransactionManager` is capable
of interacting with JPA access code as of Spring Framework 5.1 and Hibernate 5.2/5.3,
adapting to several Hibernate specifics and providing JDBC interaction.
This makes particular sense in combination with `LocalSessionFactoryBean` setup.
-See <> for details.
+See <> for details.
[[orm-jpa-dialect]]
@@ -6361,7 +6352,7 @@ seamlessly integrating with `@Bean` style configuration (no `FactoryBean` involv
====
`LocalSessionFactoryBean` and `LocalSessionFactoryBuilder` support background
bootstrapping, just as the JPA `LocalContainerEntityManagerFactoryBean` does.
-See <> for an introduction.
+See <> for an introduction.
On `LocalSessionFactoryBean`, this is available through the `bootstrapExecutor`
property. On the programmatic `LocalSessionFactoryBuilder`, an overloaded
@@ -6430,8 +6421,8 @@ These runtime exceptions wrap the original exception so that no information is l
[[oxm-marshaller-unmarshaller]]
=== `Marshaller` and `Unmarshaller`
-As stated in the <>, a marshaller serializes an object to XML, and an
-unmarshaller deserializes XML stream to an object. This section describes
+As stated in the <>, a marshaller serializes an object
+to XML, and an unmarshaller deserializes XML stream to an object. This section describes
the two Spring interfaces used for this purpose.
diff --git a/src/docs/asciidoc/index.adoc b/src/docs/asciidoc/index.adoc
index c0a5e8d4ee..175afc8518 100644
--- a/src/docs/asciidoc/index.adoc
+++ b/src/docs/asciidoc/index.adoc
@@ -3,23 +3,23 @@
:api-spring-framework: {doc-root}/spring-framework/docs/{spring-version}/javadoc-api/org/springframework
****
-_What's New_, _Upgrade Notes_, _Supported Versions_, and other topics, independent of
-release cadence, are maintained externaly on the project's
+_What's New_, _Upgrade Notes_, _Supported Versions_, and other topics,
+independent of release cadence, are maintained externaly on the project's
https://github.com/spring-projects/spring-framework/wiki[*Github Wiki*].
****
[horizontal]
-<> :: history, design philosophy,feedback,
+<> :: history, design philosophy,feedback,
getting started.
-<> :: IoC container, Events, Resources, i18n, Validation,
+<> :: IoC container, Events, Resources, i18n, Validation,
Data Binding, Type Conversion, SpEL, AOP.
-<> :: Mock objects, TestContext framework,
+<> :: Mock objects, TestContext framework,
Spring MVC Test, WebTestClient.
-<> :: Transactions, DAO support, JDBC,
+<