Polishing

This commit is contained in:
Juergen Hoeller
2019-01-08 18:45:16 +01:00
parent 183f367f2c
commit e0283c2edf
9 changed files with 56 additions and 67 deletions

View File

@@ -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.
@@ -28,8 +28,8 @@ import org.springframework.util.PropertyPlaceholderHelper.PlaceholderResolver;
import org.springframework.util.StringValueResolver;
/**
* {@link PlaceholderConfigurerSupport} subclass that resolves ${...} placeholders
* against {@link #setLocation local} {@link #setProperties properties} and/or system properties
* {@link PlaceholderConfigurerSupport} subclass that resolves ${...} placeholders against
* {@link #setLocation local} {@link #setProperties properties} and/or system properties
* and environment variables.
*
* <p>As of Spring 3.1, {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer
@@ -41,19 +41,13 @@ import org.springframework.util.StringValueResolver;
* <ul>
* <li>the {@code spring-context} module is not available (i.e., one is using Spring's
* {@code BeanFactory} API as opposed to {@code ApplicationContext}).
* <li>existing configuration makes use of the {@link #setSystemPropertiesMode(int) "systemPropertiesMode"} and/or
* {@link #setSystemPropertiesModeName(String) "systemPropertiesModeName"} properties. Users are encouraged to move
* away from using these settings, and rather configure property source search order through the container's
* {@code Environment}; however, exact preservation of functionality may be maintained by continuing to
* use {@code PropertyPlaceholderConfigurer}.
* <li>existing configuration makes use of the {@link #setSystemPropertiesMode(int) "systemPropertiesMode"}
* and/or {@link #setSystemPropertiesModeName(String) "systemPropertiesModeName"} properties.
* Users are encouraged to move away from using these settings, and rather configure property
* source search order through the container's {@code Environment}; however, exact preservation
* of functionality may be maintained by continuing to use {@code PropertyPlaceholderConfigurer}.
* </ul>
*
* <p>Prior to Spring 3.1, the {@code <context:property-placeholder/>} namespace element
* registered an instance of {@code PropertyPlaceholderConfigurer}. It will still do so if
* using the {@code spring-context-3.0.xsd} definition of the namespace. That is, you can preserve
* registration of {@code PropertyPlaceholderConfigurer} through the namespace, even if using Spring 3.1;
* simply do not update your {@code xsi:schemaLocation} and continue using the 3.0 XSD.
*
* @author Juergen Hoeller
* @author Chris Beams
* @since 02.10.2003
@@ -92,7 +86,6 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
* Set the system property mode by the name of the corresponding constant,
* e.g. "SYSTEM_PROPERTIES_MODE_OVERRIDE".
* @param constantName name of the constant
* @throws java.lang.IllegalArgumentException if an invalid constant was specified
* @see #setSystemPropertiesMode
*/
public void setSystemPropertiesModeName(String constantName) throws IllegalArgumentException {
@@ -124,11 +117,6 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
* against system environment variables. Note that it is generally recommended
* to pass external values in as JVM system properties: This can easily be
* achieved in a startup script, even for existing environment variables.
* <p><b>NOTE:</b> Access to environment variables does not work on the
* Sun VM 1.4, where the corresponding {@link System#getenv} support was
* disabled - before it eventually got re-enabled for the Sun VM 1.5.
* Please upgrade to 1.5 (or higher) if you intend to rely on the
* environment variable support.
* @see #setSystemPropertiesMode
* @see java.lang.System#getProperty(String)
* @see java.lang.System#getenv(String)
@@ -250,7 +238,7 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
}
private class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final class PropertyPlaceholderConfigurerResolver implements PlaceholderResolver {
private final Properties props;
@@ -261,7 +249,8 @@ public class PropertyPlaceholderConfigurer extends PlaceholderConfigurerSupport
@Override
@Nullable
public String resolvePlaceholder(String placeholderName) {
return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName, props, systemPropertiesMode);
return PropertyPlaceholderConfigurer.this.resolvePlaceholder(placeholderName,
this.props, systemPropertiesMode);
}
}

View File

@@ -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.
@@ -158,7 +158,7 @@ abstract class AutowireUtils {
* on the given method itself.
* <p>For example, given a factory method with the following signature, if
* {@code resolveReturnTypeForFactoryMethod()} is invoked with the reflected
* method for {@code creatProxy()} and an {@code Object[]} array containing
* method for {@code createProxy()} and an {@code Object[]} array containing
* {@code MyService.class}, {@code resolveReturnTypeForFactoryMethod()} will
* infer that the target return type is {@code MyService}.
* <pre class="code">{@code public static <T> T createProxy(Class<T> clazz)}</pre>

View File

@@ -1,5 +1,5 @@
/*
* Copyright 2002-2016 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.
@@ -82,9 +82,10 @@ public class ReplaceOverride extends MethodOverride {
if (this.typeIdentifiers.size() != method.getParameterCount()) {
return false;
}
Class<?>[] parameterTypes = method.getParameterTypes();
for (int i = 0; i < this.typeIdentifiers.size(); i++) {
String identifier = this.typeIdentifiers.get(i);
if (!method.getParameterTypes()[i].getName().contains(identifier)) {
if (!parameterTypes[i].getName().contains(identifier)) {
return false;
}
}