提交 55b0c2f2 编写于 作者: J Juergen Hoeller

Polishing

上级 1c256a11
/* /*
* Copyright 2002-2016 the original author or authors. * Copyright 2002-2017 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
...@@ -39,7 +39,7 @@ abstract class AbstractConditionalEnumConverter implements ConditionalConverter ...@@ -39,7 +39,7 @@ abstract class AbstractConditionalEnumConverter implements ConditionalConverter
@Override @Override
public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) { public boolean matches(TypeDescriptor sourceType, TypeDescriptor targetType) {
for (Class<?> interfaceType : ClassUtils.getAllInterfacesForClass(sourceType.getType())) { for (Class<?> interfaceType : ClassUtils.getAllInterfacesForClassAsSet(sourceType.getType())) {
if (this.conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) { if (this.conversionService.canConvert(TypeDescriptor.valueOf(interfaceType), targetType)) {
return false; return false;
} }
......
...@@ -153,8 +153,7 @@ public class Projection extends SpelNodeImpl { ...@@ -153,8 +153,7 @@ public class Projection extends SpelNodeImpl {
} }
nextType = nextType.getSuperclass(); nextType = nextType.getSuperclass();
} }
Class<?>[] interfaces = ClassUtils.getAllInterfacesForClass(newType); for (Class<?> nextInterface : ClassUtils.getAllInterfacesForClassAsSet(newType)) {
for (Class<?> nextInterface : interfaces) {
if (nextInterface.isAssignableFrom(oldType)) { if (nextInterface.isAssignableFrom(oldType)) {
return nextInterface; return nextInterface;
} }
......
...@@ -2034,7 +2034,7 @@ treats them as errors. ...@@ -2034,7 +2034,7 @@ treats them as errors.
[[transaction-resources]] [[transaction-resources]]
=== Further Resources === Further resources
For more information about the Spring Framework's transaction support: For more information about the Spring Framework's transaction support:
...@@ -2457,7 +2457,7 @@ last code snippet as follows: ...@@ -2457,7 +2457,7 @@ last code snippet as follows:
---- ----
[[jdbc-JdbcTemplate-examples-update]] [[jdbc-JdbcTemplate-examples-update]]
====== Updating (INSERT/UPDATE/DELETE) with jdbcTemplate ====== Updating (INSERT/UPDATE/DELETE) with JdbcTemplate
You use the `update(..)` method to perform insert, update and delete operations. You use the `update(..)` method to perform insert, update and delete operations.
Parameter values are usually provided as var args or alternatively as an object array. Parameter values are usually provided as var args or alternatively as an object array.
...@@ -2487,7 +2487,7 @@ Parameter values are usually provided as var args or alternatively as an object ...@@ -2487,7 +2487,7 @@ Parameter values are usually provided as var args or alternatively as an object
---- ----
[[jdbc-JdbcTemplate-examples-other]] [[jdbc-JdbcTemplate-examples-other]]
====== Other jdbcTemplate operations ====== Other JdbcTemplate operations
You can use the `execute(..)` method to execute any arbitrary SQL, and as such the You can use the `execute(..)` method to execute any arbitrary SQL, and as such the
method is often used for DDL statements. It is heavily overloaded with variants taking method is often used for DDL statements. It is heavily overloaded with variants taking
...@@ -3348,7 +3348,6 @@ The same example using classic JDBC "?" placeholders: ...@@ -3348,7 +3348,6 @@ The same example using classic JDBC "?" placeholders:
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3398,7 +3397,6 @@ This example shows a batch update using a batch size of 100: ...@@ -3398,7 +3397,6 @@ This example shows a batch update using a batch size of 100:
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3540,7 +3538,6 @@ You can limit the columns for an insert by specifying a list of column names wit ...@@ -3540,7 +3538,6 @@ You can limit the columns for an insert by specifying a list of column names wit
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3580,7 +3577,6 @@ values. Here is an example: ...@@ -3580,7 +3577,6 @@ values. Here is an example:
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3611,7 +3607,6 @@ convenient `addValue` method that can be chained. ...@@ -3611,7 +3607,6 @@ convenient `addValue` method that can be chained.
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3683,7 +3678,6 @@ of the stored procedure. ...@@ -3683,7 +3678,6 @@ of the stored procedure.
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3724,7 +3718,6 @@ the constructor of your `SimpleJdbcCall`. Here is an example of this configurati ...@@ -3724,7 +3718,6 @@ the constructor of your `SimpleJdbcCall`. Here is an example of this configurati
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3883,7 +3876,6 @@ To call this function we again create a `SimpleJdbcCall` in the initialization m ...@@ -3883,7 +3876,6 @@ To call this function we again create a `SimpleJdbcCall` in the initialization m
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -3943,7 +3935,6 @@ created by passing in the required class to map to in the `newInstance` method. ...@@ -3943,7 +3935,6 @@ created by passing in the required class to map to in the `newInstance` method.
} }
// ... additional methods // ... additional methods
} }
---- ----
...@@ -5759,6 +5750,7 @@ thus are isolated from each other. ...@@ -5759,6 +5750,7 @@ thus are isolated from each other.
[[orm-jpa-multiple]] [[orm-jpa-multiple]]
===== Dealing with multiple persistence units ===== Dealing with multiple persistence units
For applications that rely on multiple persistence units locations, stored in various For applications that rely on multiple persistence units locations, stored in various
JARS in the classpath, for example, Spring offers the `PersistenceUnitManager` to act as JARS in the classpath, for example, Spring offers the `PersistenceUnitManager` to act as
a central repository and to avoid the persistence units discovery process, which can be a central repository and to avoid the persistence units discovery process, which can be
...@@ -6038,6 +6030,7 @@ less portable, but will be set up for the server's JTA environment out of the bo ...@@ -6038,6 +6030,7 @@ less portable, but will be set up for the server's JTA environment out of the bo
[[oxm-introduction]] [[oxm-introduction]]
=== Introduction === Introduction
In this chapter, we will describe Spring's Object/XML Mapping support. Object/XML In this chapter, we will describe Spring's Object/XML Mapping support. Object/XML
Mapping, or O/X mapping for short, is the act of converting an XML document to and from Mapping, or O/X mapping for short, is the act of converting an XML document to and from
an object. This conversion process is also known as XML Marshalling, or XML an object. This conversion process is also known as XML Marshalling, or XML
...@@ -6055,12 +6048,12 @@ Some of the benefits of using Spring for your O/X mapping needs are: ...@@ -6055,12 +6048,12 @@ Some of the benefits of using Spring for your O/X mapping needs are:
Spring's bean factory makes it easy to configure marshallers, without needing to Spring's bean factory makes it easy to configure marshallers, without needing to
construct JAXB context, JiBX binding factories, etc. The marshallers can be configured construct JAXB context, JiBX binding factories, etc. The marshallers can be configured
as any other bean in your application context. Additionally, XML Schema-based as any other bean in your application context. Additionally, XML namespace-based
configuration is available for a number of marshallers, making the configuration even configuration is available for a number of marshallers, making the configuration even
simpler. simpler.
==== Consistent Interfaces ==== Consistent interfaces
Spring's O/X mapping operates through two global interfaces: the `Marshaller` and Spring's O/X mapping operates through two global interfaces: the `Marshaller` and
`Unmarshaller` interface. These abstractions allow you to switch O/X mapping frameworks `Unmarshaller` interface. These abstractions allow you to switch O/X mapping frameworks
...@@ -6071,7 +6064,7 @@ other using Castor) in a non-intrusive fashion, leveraging the strength of each ...@@ -6071,7 +6064,7 @@ other using Castor) in a non-intrusive fashion, leveraging the strength of each
technology. technology.
==== Consistent Exception Hierarchy ==== Consistent exception hierarchy
Spring provides a conversion from exceptions from the underlying O/X mapping tool to its Spring provides a conversion from exceptions from the underlying O/X mapping tool to its
own exception hierarchy with the `XmlMappingException` as the root exception. As can be own exception hierarchy with the `XmlMappingException` as the root exception. As can be
...@@ -6322,7 +6315,7 @@ This sample application produces the following `settings.xml` file: ...@@ -6322,7 +6315,7 @@ This sample application produces the following `settings.xml` file:
[[oxm-schema-based-config]] [[oxm-schema-based-config]]
=== XML Schema-based Configuration === XML configuration namespace
Marshallers could be configured more concisely using tags from the OXM namespace. To Marshallers could be configured more concisely using tags from the OXM namespace. To
make these tags available, the appropriate schema has to be referenced first in the make these tags available, the appropriate schema has to be referenced first in the
...@@ -6397,7 +6390,7 @@ validation is performed by specifying one or more schema resource to the bean, l ...@@ -6397,7 +6390,7 @@ validation is performed by specifying one or more schema resource to the bean, l
---- ----
[[oxm-jaxb2-xsd]] [[oxm-jaxb2-xsd]]
===== XML Schema-based Configuration ===== XML configuration namespace
The `jaxb2-marshaller` tag configures a `org.springframework.oxm.jaxb.Jaxb2Marshaller`. The `jaxb2-marshaller` tag configures a `org.springframework.oxm.jaxb.Jaxb2Marshaller`.
Here is an example: Here is an example:
...@@ -6488,7 +6481,7 @@ with a classpath resource. ...@@ -6488,7 +6481,7 @@ with a classpath resource.
---- ----
[[oxm-castor-xsd]] [[oxm-castor-xsd]]
===== XML Schema-based Configuration ===== XML configuration namespace
The `castor-marshaller` tag configures a The `castor-marshaller` tag configures a
`org.springframework.oxm.castor.CastorMarshaller`. Here is an example: `org.springframework.oxm.castor.CastorMarshaller`. Here is an example:
...@@ -6574,7 +6567,7 @@ classes, you have to configure multiple ``JibxMarshaller``s with different `targ ...@@ -6574,7 +6567,7 @@ classes, you have to configure multiple ``JibxMarshaller``s with different `targ
property values. property values.
[[oxm-jibx-xsd]] [[oxm-jibx-xsd]]
===== XML Schema-based Configuration ===== XML configuration namespace
The `jibx-marshaller` tag configures a `org.springframework.oxm.jibx.JibxMarshaller`. The `jibx-marshaller` tag configures a `org.springframework.oxm.jibx.JibxMarshaller`.
Here is an example: Here is an example:
......
...@@ -1231,7 +1231,7 @@ to serialize only a subset of the object properties. For example: ...@@ -1231,7 +1231,7 @@ to serialize only a subset of the object properties. For example:
[[rest-message-conversion]] [[rest-message-conversion]]
==== HTTP Message Conversion ==== HTTP message conversion
Objects passed to and returned from the methods `getForObject()`, `postForLocation()`, Objects passed to and returned from the methods `getForObject()`, `postForLocation()`,
and `put()` are converted to HTTP requests and from HTTP responses by and `put()` are converted to HTTP requests and from HTTP responses by
...@@ -1354,6 +1354,7 @@ Please use the <<web-reactive.adoc#webflux-client,WebClient>> instead. ...@@ -1354,6 +1354,7 @@ Please use the <<web-reactive.adoc#webflux-client,WebClient>> instead.
[[ejb-introduction]] [[ejb-introduction]]
=== Introduction === Introduction
As a lightweight container, Spring is often considered an EJB replacement. We do believe As a lightweight container, Spring is often considered an EJB replacement. We do believe
that for many if not most applications and use cases, Spring as a container, combined that for many if not most applications and use cases, Spring as a container, combined
with its rich supporting functionality in the area of transactions, ORM and JDBC access, with its rich supporting functionality in the area of transactions, ORM and JDBC access,
...@@ -2031,7 +2032,7 @@ these callback methods. ...@@ -2031,7 +2032,7 @@ these callback methods.
[[jms-receiving-sync]] [[jms-receiving-sync]]
==== Synchronous Reception ==== Synchronous reception
While JMS is typically associated with asynchronous processing, it is possible to While JMS is typically associated with asynchronous processing, it is possible to
consume messages synchronously. The overloaded `receive(..)` methods provide this consume messages synchronously. The overloaded `receive(..)` methods provide this
...@@ -2042,7 +2043,7 @@ the receiver should wait before giving up waiting for a message. ...@@ -2042,7 +2043,7 @@ the receiver should wait before giving up waiting for a message.
[[jms-asynchronousMessageReception]] [[jms-asynchronousMessageReception]]
==== Asynchronous Reception - Message-Driven POJOs ==== Asynchronous reception: Message-Driven POJOs
[NOTE] [NOTE]
==== ====
...@@ -2113,7 +2114,7 @@ description of the features supported by each implementation. ...@@ -2113,7 +2114,7 @@ description of the features supported by each implementation.
[[jms-receiving-async-session-aware-message-listener]] [[jms-receiving-async-session-aware-message-listener]]
==== the SessionAwareMessageListener interface ==== SessionAwareMessageListener interface
The `SessionAwareMessageListener` interface is a Spring-specific interface that provides The `SessionAwareMessageListener` interface is a Spring-specific interface that provides
a similar contract to the JMS `MessageListener` interface, but also provides the message a similar contract to the JMS `MessageListener` interface, but also provides the message
...@@ -2148,7 +2149,7 @@ responsibility of the client code to handle any exceptions thrown. ...@@ -2148,7 +2149,7 @@ responsibility of the client code to handle any exceptions thrown.
[[jms-receiving-async-message-listener-adapter]] [[jms-receiving-async-message-listener-adapter]]
==== the MessageListenerAdapter ==== MessageListenerAdapter
The `MessageListenerAdapter` class is the final component in Spring's asynchronous The `MessageListenerAdapter` class is the final component in Spring's asynchronous
messaging support: in a nutshell, it allows you to expose almost __any__ class as a MDP messaging support: in a nutshell, it allows you to expose almost __any__ class as a MDP
...@@ -3369,7 +3370,7 @@ for controlling the management interfaces of your beans. ...@@ -3369,7 +3370,7 @@ for controlling the management interfaces of your beans.
[[jmx-interface-assembler]] [[jmx-interface-assembler]]
==== the MBeanInfoAssembler Interface ==== MBeanInfoAssembler interface
Behind the scenes, the `MBeanExporter` delegates to an implementation of the Behind the scenes, the `MBeanExporter` delegates to an implementation of the
`org.springframework.jmx.export.assembler.MBeanInfoAssembler` interface which is `org.springframework.jmx.export.assembler.MBeanInfoAssembler` interface which is
...@@ -3383,7 +3384,7 @@ interface using either source-level metadata or any arbitrary interface. ...@@ -3383,7 +3384,7 @@ interface using either source-level metadata or any arbitrary interface.
[[jmx-interface-metadata]] [[jmx-interface-metadata]]
==== Using Source-Level Metadata (Java annotations) ==== Using source-level metadata: Java annotations
Using the `MetadataMBeanInfoAssembler` you can define the management interfaces for your Using the `MetadataMBeanInfoAssembler` you can define the management interfaces for your
beans using source level metadata. The reading of metadata is encapsulated by the beans using source level metadata. The reading of metadata is encapsulated by the
...@@ -3526,12 +3527,12 @@ metadata-driven management interfaces for your Spring-exposed MBeans. ...@@ -3526,12 +3527,12 @@ metadata-driven management interfaces for your Spring-exposed MBeans.
[[jmx-interface-metadata-types]] [[jmx-interface-metadata-types]]
==== Source-Level Metadata Types ==== Source-level metadata types
The following source level metadata types are available for use in Spring JMX: The following source level metadata types are available for use in Spring JMX:
[[jmx-metadata-types]] [[jmx-metadata-types]]
.Source-Level Metadata Types .Source-level metadata types
|=== |===
| Purpose| Annotation| Annotation Type | Purpose| Annotation| Annotation Type
...@@ -3556,7 +3557,7 @@ The following configuration parameters are available for use on these source-lev ...@@ -3556,7 +3557,7 @@ The following configuration parameters are available for use on these source-lev
metadata types: metadata types:
[[jmx-metadata-parameters]] [[jmx-metadata-parameters]]
.Source-Level Metadata Parameters .Source-level metadata parameters
[cols="1,3,1"] [cols="1,3,1"]
|=== |===
| Parameter| Description| Applies to | Parameter| Description| Applies to
...@@ -3612,7 +3613,7 @@ metadata types: ...@@ -3612,7 +3613,7 @@ metadata types:
[[jmx-interface-autodetect]] [[jmx-interface-autodetect]]
==== the AutodetectCapableMBeanInfoAssembler interface ==== AutodetectCapableMBeanInfoAssembler interface
To simplify configuration even further, Spring introduces the To simplify configuration even further, Spring introduces the
`AutodetectCapableMBeanInfoAssembler` interface which extends the `MBeanInfoAssembler` `AutodetectCapableMBeanInfoAssembler` interface which extends the `MBeanInfoAssembler`
...@@ -3971,7 +3972,7 @@ connectors. ...@@ -3971,7 +3972,7 @@ connectors.
[[jmx-jsr160-server]] [[jmx-jsr160-server]]
==== Server-side Connectors ==== Server-side connectors
To have Spring JMX create, start and expose a JSR-160 `JMXConnectorServer` use the To have Spring JMX create, start and expose a JSR-160 `JMXConnectorServer` use the
following configuration: following configuration:
...@@ -4042,7 +4043,7 @@ snippet of configuration: ...@@ -4042,7 +4043,7 @@ snippet of configuration:
[[jmx-jsr160-client]] [[jmx-jsr160-client]]
==== Client-side Connectors ==== Client-side connectors
To create an `MBeanServerConnection` to a remote JSR-160 enabled `MBeanServer` use the To create an `MBeanServerConnection` to a remote JSR-160 enabled `MBeanServer` use the
`MBeanServerConnectionFactoryBean` as shown below: `MBeanServerConnectionFactoryBean` as shown below:
...@@ -4080,7 +4081,7 @@ documentation for more information. ...@@ -4080,7 +4081,7 @@ documentation for more information.
[[jmx-proxy]] [[jmx-proxy]]
=== Accessing MBeans via Proxies === Accessing MBeans via proxies
Spring JMX allows you to create proxies that re-route calls to MBeans registered in a Spring JMX allows you to create proxies that re-route calls to MBeans registered in a
local or remote `MBeanServer`. These proxies provide you with a standard Java interface local or remote `MBeanServer`. These proxies provide you with a standard Java interface
...@@ -4137,7 +4138,7 @@ Spring's JMX offering includes comprehensive support for JMX notifications. ...@@ -4137,7 +4138,7 @@ Spring's JMX offering includes comprehensive support for JMX notifications.
[[jmx-notifications-listeners]] [[jmx-notifications-listeners]]
==== Registering Listeners for Notifications ==== Registering listeners for notifications
Spring's JMX support makes it very easy to register any number of Spring's JMX support makes it very easy to register any number of
`NotificationListeners` with any number of MBeans (this includes MBeans exported by `NotificationListeners` with any number of MBeans (this includes MBeans exported by
...@@ -4442,7 +4443,7 @@ you can accept the coupling to both Spring and JMX, then do so. ...@@ -4442,7 +4443,7 @@ you can accept the coupling to both Spring and JMX, then do so.
[[jmx-resources]] [[jmx-resources]]
=== Further Resources === Further resources
This section contains links to further resources about JMX. This section contains links to further resources about JMX.
...@@ -6123,7 +6124,7 @@ much more flexible. ...@@ -6123,7 +6124,7 @@ much more flexible.
[[scheduling-trigger-interface]] [[scheduling-trigger-interface]]
==== the Trigger interface ==== Trigger interface
The `Trigger` interface is essentially inspired by JSR-236, which, as of Spring 3.0, has The `Trigger` interface is essentially inspired by JSR-236, which, as of Spring 3.0, has
not yet been officially implemented. The basic idea of the `Trigger` is that execution not yet been officially implemented. The basic idea of the `Trigger` is that execution
...@@ -6850,7 +6851,7 @@ javadocs] for more information. ...@@ -6850,7 +6851,7 @@ javadocs] for more information.
=== Introduction === Introduction
Since version 3.1, Spring Framework provides support for transparently adding caching Since version 3.1, Spring Framework provides support for transparently adding caching
into an existing Spring application. Similar to the <<data-acess.adoc#transaction,transaction>> into an existing Spring application. Similar to the <<data-access.adoc#transaction,transaction>>
support, the caching abstraction allows consistent use of various caching solutions with minimal support, the caching abstraction allows consistent use of various caching solutions with minimal
impact on the code. impact on the code.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册