Polishing
This commit is contained in:
parent
507d4ba825
commit
6f1b583130
|
@ -272,7 +272,7 @@ abstract class AutowireUtils {
|
|||
|
||||
|
||||
/**
|
||||
* Reflective InvocationHandler for lazy access to the current target object.
|
||||
* Reflective {@link InvocationHandler} for lazy access to the current target object.
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
private static class ObjectFactoryDelegatingInvocationHandler implements InvocationHandler, Serializable {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -287,7 +287,7 @@ class ConstructorResolver {
|
|||
}
|
||||
|
||||
private Object instantiate(
|
||||
String beanName, RootBeanDefinition mbd, Constructor constructorToUse, Object[] argsToUse) {
|
||||
String beanName, RootBeanDefinition mbd, Constructor<?> constructorToUse, Object[] argsToUse) {
|
||||
|
||||
try {
|
||||
InstantiationStrategy strategy = this.beanFactory.getInstantiationStrategy();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -27,6 +27,8 @@ import org.springframework.util.ReflectionUtils;
|
|||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link AutowireUtils}.
|
||||
*
|
||||
* @author Juergen Hoeller
|
||||
* @author Sam Brannen
|
||||
*/
|
||||
|
@ -36,7 +38,7 @@ public class AutowireUtilsTests {
|
|||
public void genericMethodReturnTypes() {
|
||||
Method notParameterized = ReflectionUtils.findMethod(MyTypeWithMethods.class, "notParameterized");
|
||||
assertEquals(String.class,
|
||||
AutowireUtils.resolveReturnTypeForFactoryMethod(notParameterized, new Object[]{}, getClass().getClassLoader()));
|
||||
AutowireUtils.resolveReturnTypeForFactoryMethod(notParameterized, new Object[0], getClass().getClassLoader()));
|
||||
|
||||
Method notParameterizedWithArguments = ReflectionUtils.findMethod(MyTypeWithMethods.class, "notParameterizedWithArguments", Integer.class, Boolean.class);
|
||||
assertEquals(String.class,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -43,11 +43,11 @@ import org.springframework.util.StringUtils;
|
|||
*/
|
||||
public abstract class AbstractServerHttpRequest implements ServerHttpRequest {
|
||||
|
||||
protected final Log logger = HttpLogging.forLogName(getClass());
|
||||
|
||||
private static final Pattern QUERY_PATTERN = Pattern.compile("([^&=]+)(=?)([^&]+)?");
|
||||
|
||||
|
||||
protected final Log logger = HttpLogging.forLogName(getClass());
|
||||
|
||||
private final URI uri;
|
||||
|
||||
private final RequestPath path;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -95,7 +95,7 @@ class HtmlCharacterEntityDecoder {
|
|||
int skipUntilIndex = (this.nextPotentialReferencePosition != -1 ?
|
||||
this.nextPotentialReferencePosition : this.originalMessage.length());
|
||||
if (skipUntilIndex - this.currentPosition > 3) {
|
||||
this.decodedMessage.append(this.originalMessage.substring(this.currentPosition, skipUntilIndex));
|
||||
this.decodedMessage.append(this.originalMessage, this.currentPosition, skipUntilIndex);
|
||||
this.currentPosition = skipUntilIndex;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2018 the original author or authors.
|
||||
* Copyright 2002-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -418,7 +418,7 @@ public abstract class ResponseEntityExceptionHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* Customize the response for NoHandlerFoundException.
|
||||
* Customize the response for AsyncRequestTimeoutException.
|
||||
* <p>This method delegates to {@link #handleExceptionInternal}.
|
||||
* @param ex the exception
|
||||
* @param headers the headers to be written to the response
|
||||
|
@ -446,7 +446,7 @@ public abstract class ResponseEntityExceptionHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
* A single place to customize the response body of all Exception types.
|
||||
* A single place to customize the response body of all exception types.
|
||||
* <p>The default implementation sets the {@link WebUtils#ERROR_EXCEPTION_ATTRIBUTE}
|
||||
* request attribute and creates a {@link ResponseEntity} from the given
|
||||
* body, headers, and status.
|
||||
|
|
|
@ -202,7 +202,7 @@ implementation detail actually means.
|
|||
|
||||
@AspectJ refers to a style of declaring aspects as regular Java classes annotated with
|
||||
annotations. The @AspectJ style was introduced by the
|
||||
http://www.eclipse.org/aspectj[AspectJ project] as part of the AspectJ 5 release. Spring
|
||||
https://www.eclipse.org/aspectj[AspectJ project] as part of the AspectJ 5 release. Spring
|
||||
interprets the same annotations as AspectJ 5, using a library supplied by AspectJ
|
||||
for pointcut parsing and matching. The AOP runtime is still pure Spring AOP, though, and
|
||||
there is no dependency on the AspectJ compiler or weaver.
|
||||
|
@ -352,9 +352,9 @@ matches the execution of any method named `transfer`:
|
|||
|
||||
The pointcut expression that forms the value of the `@Pointcut` annotation is a regular
|
||||
AspectJ 5 pointcut expression. For a full discussion of AspectJ's pointcut language, see
|
||||
the http://www.eclipse.org/aspectj/doc/released/progguide/index.html[AspectJ
|
||||
the https://www.eclipse.org/aspectj/doc/released/progguide/index.html[AspectJ
|
||||
Programming Guide] (and, for extensions, the
|
||||
http://www.eclipse.org/aspectj/doc/released/adk15notebook/index.html[AspectJ 5
|
||||
https://www.eclipse.org/aspectj/doc/released/adk15notebook/index.html[AspectJ 5
|
||||
Developer's Notebook]) or one of the books on AspectJ (such as _Eclipse AspectJ_, by Colyer
|
||||
et. al., or _AspectJ in Action_, by Ramnivas Laddad).
|
||||
|
||||
|
@ -462,9 +462,8 @@ it is natural and straightforward to identify specific beans by name.
|
|||
[[aop-pointcuts-combining]]
|
||||
==== Combining Pointcut Expressions
|
||||
|
||||
You can combine pointcut expressions can be combined by using `&&,` `||` and `!`. You can also
|
||||
refer to pointcut expressions by name. The following example shows three pointcut
|
||||
expressions:
|
||||
You can combine pointcut expressions by using `&&,` `||` and `!`. You can also refer to
|
||||
pointcut expressions by name. The following example shows three pointcut expressions:
|
||||
|
||||
====
|
||||
[source,java,indent=0]
|
||||
|
@ -620,7 +619,7 @@ method that takes no parameters, whereas `(..)` matches any number (zero or more
|
|||
The `({asterisk})` pattern matches a method that takes one parameter of any type.
|
||||
`(*,String)` matches a method that takes two parameters. The first can be of any type, while the
|
||||
second must be a `String`. Consult the
|
||||
http://www.eclipse.org/aspectj/doc/released/progguide/semantics-pointcuts.html[Language
|
||||
https://www.eclipse.org/aspectj/doc/released/progguide/semantics-pointcuts.html[Language
|
||||
Semantics] section of the AspectJ Programming Guide for more information.
|
||||
|
||||
The following examples show some common pointcut expressions:
|
||||
|
@ -1317,7 +1316,7 @@ following strategy to determine parameter names:
|
|||
====
|
||||
+
|
||||
If the first parameter is of the `JoinPoint`, `ProceedingJoinPoint`, or
|
||||
`JoinPoint.StaticPart` type, you ca leave out the name of the parameter from the value
|
||||
`JoinPoint.StaticPart` type, you can leave out the name of the parameter from the value
|
||||
of the `argNames` attribute. For example, if you modify the preceding advice to receive
|
||||
the join point object, the `argNames` attribute need not include it:
|
||||
+
|
||||
|
@ -2514,7 +2513,7 @@ simple method executions (for example, field get or set join points and so on).
|
|||
When you use AspectJ, you have the choice of the AspectJ language syntax (also known as
|
||||
the "`code style`") or the @AspectJ annotation style. Clearly, if you do not use Java
|
||||
5+, the choice has been made for you: Use the code style. If aspects play a large
|
||||
role in your design, and you are able to use the http://www.eclipse.org/ajdt/[AspectJ
|
||||
role in your design, and you are able to use the https://www.eclipse.org/ajdt/[AspectJ
|
||||
Development Tools (AJDT)] plugin for Eclipse, the AspectJ language syntax is the
|
||||
preferred option. It is cleaner and simpler because the language was purposefully
|
||||
designed for writing aspects. If you do not use Eclipse or have only a few aspects
|
||||
|
@ -2946,7 +2945,7 @@ using Spring in accordance with the properties of the annotation`". In this cont
|
|||
"`initialization`" refers to newly instantiated objects (for example, objects instantiated
|
||||
with the `new` operator) as well as to `Serializable` objects that are undergoing
|
||||
deserialization (for example, through
|
||||
http://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html[readResolve()]).
|
||||
https://docs.oracle.com/javase/8/docs/api/java/io/Serializable.html[readResolve()]).
|
||||
|
||||
[NOTE]
|
||||
=====
|
||||
|
@ -2969,14 +2968,14 @@ available for use in the body of the constructors, you need to define this on th
|
|||
|
||||
You can find more information about the language semantics of the various pointcut
|
||||
types in AspectJ
|
||||
http://www.eclipse.org/aspectj/doc/next/progguide/semantics-joinPoints.html[in this
|
||||
appendix] of the http://www.eclipse.org/aspectj/doc/next/progguide/index.html[AspectJ
|
||||
https://www.eclipse.org/aspectj/doc/next/progguide/semantics-joinPoints.html[in this
|
||||
appendix] of the https://www.eclipse.org/aspectj/doc/next/progguide/index.html[AspectJ
|
||||
Programming Guide].
|
||||
=====
|
||||
|
||||
For this to work, the annotated types must be woven with the AspectJ weaver. You can
|
||||
either use a build-time Ant or Maven task to do this (see, for example, the
|
||||
http://www.eclipse.org/aspectj/doc/released/devguide/antTasks.html[AspectJ Development
|
||||
https://www.eclipse.org/aspectj/doc/released/devguide/antTasks.html[AspectJ Development
|
||||
Environment Guide]) or load-time weaving (see <<aop-aj-ltw>>). The
|
||||
`AnnotationBeanConfigurerAspect` itself needs to be configured by Spring (in order to obtain
|
||||
a reference to the bean factory that is to be used to configure new objects). If you
|
||||
|
@ -3202,7 +3201,7 @@ The focus of this section is on configuring and using LTW in the specific contex
|
|||
Spring Framework. This section is not a general introduction to LTW. For full details on
|
||||
the specifics of LTW and configuring LTW with only AspectJ (with Spring not being
|
||||
involved at all), see the
|
||||
http://www.eclipse.org/aspectj/doc/released/devguide/ltw.html[LTW section of the AspectJ
|
||||
https://www.eclipse.org/aspectj/doc/released/devguide/ltw.html[LTW section of the AspectJ
|
||||
Development Environment Guide].
|
||||
|
||||
The value that the Spring Framework brings to AspectJ LTW is in enabling much
|
||||
|
@ -3549,20 +3548,20 @@ The following table summarizes various `LoadTimeWeaver` implementations:
|
|||
|===
|
||||
| Runtime Environment| `LoadTimeWeaver` implementation
|
||||
|
||||
| Running in http://tomcat.apache.org/[Apache Tomcat]
|
||||
| Running in https://tomcat.apache.org/[Apache Tomcat]
|
||||
| `TomcatLoadTimeWeaver`
|
||||
|
||||
| Running in http://glassfish.dev.java.net/[GlassFish] (limited to EAR deployments)
|
||||
| Running in https://glassfish.dev.java.net/[GlassFish] (limited to EAR deployments)
|
||||
| `GlassFishLoadTimeWeaver`
|
||||
|
||||
| Running in Red Hat's http://www.jboss.org/jbossas/[JBoss AS] or http://www.wildfly.org/[WildFly]
|
||||
| Running in Red Hat's https://www.jboss.org/jbossas/[JBoss AS] or https://www.wildfly.org/[WildFly]
|
||||
| `JBossLoadTimeWeaver`
|
||||
|
||||
| Running in IBM's http://www-01.ibm.com/software/webservers/appserv/was/[WebSphere]
|
||||
| Running in IBM's https://www-01.ibm.com/software/webservers/appserv/was/[WebSphere]
|
||||
| `WebSphereLoadTimeWeaver`
|
||||
|
||||
| Running in Oracle's
|
||||
http://www.oracle.com/technetwork/middleware/weblogic/overview/index-085209.html[WebLogic]
|
||||
https://www.oracle.com/technetwork/middleware/weblogic/overview/index-085209.html[WebLogic]
|
||||
| `WebLogicLoadTimeWeaver`
|
||||
|
||||
| JVM started with Spring `InstrumentationSavingAgent`
|
||||
|
@ -3718,7 +3717,7 @@ Spring Boot applications, you typically control the entire JVM setup in any case
|
|||
[[aop-resources]]
|
||||
== Further Resources
|
||||
|
||||
More information on AspectJ can be found on the http://www.eclipse.org/aspectj[AspectJ website].
|
||||
More information on AspectJ can be found on the https://www.eclipse.org/aspectj[AspectJ website].
|
||||
|
||||
_Eclipse AspectJ_ by Adrian Colyer et. al. (Addison-Wesley, 2005) provides a
|
||||
comprehensive introduction and reference for the AspectJ language.
|
||||
|
|
|
@ -711,7 +711,7 @@ redirect is needed. The rest of the view name is the redirect URL.
|
|||
The net effect is the same as if the controller had returned a `RedirectView`, but now
|
||||
the controller itself can operate in terms of logical view names. A logical view
|
||||
name (such as `redirect:/myapp/some/resource`) redirects relative to the current
|
||||
Servlet context, while a name such as `redirect:http://myhost.com/some/arbitrary/path`
|
||||
Servlet context, while a name such as `redirect:https://myhost.com/some/arbitrary/path`
|
||||
redirects to an absolute URL.
|
||||
|
||||
Note that, if a controller method is annotated with the `@ResponseStatus`, the annotation
|
||||
|
@ -1297,7 +1297,7 @@ directly to the response body versus view resolution and rendering with an HTML
|
|||
[[mvc-ann-requestmapping-proxying]]
|
||||
==== AOP Proxies
|
||||
|
||||
In some cases, you many need to decorate a controller with an AOP proxy at runtime.
|
||||
In some cases, you may need to decorate a controller with an AOP proxy at runtime.
|
||||
One example is if you choose to have `@Transactional` annotations directly on the
|
||||
controller. When this is the case, for controllers specifically, we recommend
|
||||
using class-based proxying. This is typically the default choice with controllers.
|
||||
|
@ -1449,7 +1449,7 @@ sorted last. Also, prefix patterns (such as `/public/{asterisk}{asterisk}`) are
|
|||
specific than other pattern that do not have double wildcards.
|
||||
|
||||
For the full details, see {api-spring-framework}/util/AntPathMatcher.AntPatternComparator.html[`AntPatternComparator`]
|
||||
in {api-spring-framework}/util/AntPathMatcher.html[`AntPathMatcher`] and also keep mind that
|
||||
in {api-spring-framework}/util/AntPathMatcher.html[`AntPathMatcher`] and also keep in mind that
|
||||
you can customize the {api-spring-framework}/util/PathMatcher.html[`PathMatcher`] implementation.
|
||||
See <<mvc-config-path-matching>> in the configuration section.
|
||||
|
||||
|
@ -1508,7 +1508,7 @@ Many common path extensions are whitelisted by default. Applications with custom
|
|||
negotiation to avoid having a `Content-Disposition` header added for those extensions.
|
||||
See <<mvc-config-content-negotiation>>.
|
||||
|
||||
See http://pivotal.io/security/cve-2015-5211[CVE-2015-5211] for additional
|
||||
See https://pivotal.io/security/cve-2015-5211[CVE-2015-5211] for additional
|
||||
recommendations related to RFD.
|
||||
|
||||
|
||||
|
@ -1965,9 +1965,9 @@ See <<core.adoc#format, Spring Field Formatting>>.
|
|||
==== Matrix Variables
|
||||
[.small]#<<web-reactive.adoc#webflux-ann-matrix-variables, Same as in Spring WebFlux>>#
|
||||
|
||||
http://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
https://tools.ietf.org/html/rfc3986#section-3.3[RFC 3986] discusses name-value pairs in
|
||||
path segments. In Spring MVC, we refer to those as "`matrix variables`" based on an
|
||||
http://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
https://www.w3.org/DesignIssues/MatrixURIs.html["`old post`"] by Tim Berners-Lee, but they
|
||||
can be also be referred to as URI path parameters.
|
||||
|
||||
Matrix variables can appear in any path segment, with each variable separated by a semicolon and
|
||||
|
@ -3853,7 +3853,7 @@ suitable under load. If you plan to stream with a reactive type, you should use
|
|||
|
||||
The Servlet API does not provide any notification when a remote client goes away.
|
||||
Therefore, while streaming to the response, whether through <<mvc-ann-async-sse, SseEmitter>>
|
||||
or <<mvc-ann-async-reactive-types, reactive types>, it is important to send data periodically,
|
||||
or <<mvc-ann-async-reactive-types, reactive types>>, it is important to send data periodically,
|
||||
since the write fails if the client has disconnected. The send could take the form of an
|
||||
empty (comment-only) SSE event or any other data that the other side would have to interpret
|
||||
as a heartbeat and ignore.
|
||||
|
|
Loading…
Reference in New Issue