Browse Source

Polishing (backported from master)

pull/27107/head
Juergen Hoeller 5 years ago
parent
commit
dd3262bfe3
  1. 4
      spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java
  2. 20
      spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java
  3. 8
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java
  4. 6
      spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java
  5. 6
      spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java
  6. 17
      spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java
  7. 16
      spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java

4
spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2012 the original author or authors. * Copyright 2002-2021 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.
@ -26,7 +26,7 @@ import org.aopalliance.aop.Advice;
* <p>Introductions are often <b>mixins</b>, enabling the building of composite * <p>Introductions are often <b>mixins</b>, enabling the building of composite
* objects that can achieve many of the goals of multiple inheritance in Java. * objects that can achieve many of the goals of multiple inheritance in Java.
* *
* <p>Compared to {qlink IntroductionInfo}, this interface allows an advice to * <p>Compared to {@link IntroductionInfo}, this interface allows an advice to
* implement a range of interfaces that is not necessarily known in advance. * implement a range of interfaces that is not necessarily known in advance.
* Thus an {@link IntroductionAdvisor} can be used to specify which interfaces * Thus an {@link IntroductionAdvisor} can be used to specify which interfaces
* will be exposed in an advised object. * will be exposed in an advised object.

20
spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 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.
@ -36,15 +36,16 @@ import org.springframework.util.StringValueResolver;
* Example XML bean definition: * Example XML bean definition:
* *
* <pre class="code"> * <pre class="code">
* &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"/&gt; * &lt;bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"&gt;
* &lt;property name="driverClassName" value="${driver}"/&gt; * &lt;property name="driverClassName" value="${driver}" /&gt;
* &lt;property name="url" value="jdbc:${dbname}"/&gt; * &lt;property name="url" value="jdbc:${dbname}" /&gt;
* &lt;/bean&gt; * &lt;/bean&gt;
* </pre> * </pre>
* *
* Example properties file: * Example properties file:
* *
* <pre class="code">driver=com.mysql.jdbc.Driver * <pre class="code">
* driver=com.mysql.jdbc.Driver
* dbname=mysql:mydb</pre> * dbname=mysql:mydb</pre>
* *
* Annotated bean definitions may take advantage of property replacement using * Annotated bean definitions may take advantage of property replacement using
@ -56,7 +57,8 @@ import org.springframework.util.StringValueResolver;
* in bean references. Furthermore, placeholder values can also cross-reference * in bean references. Furthermore, placeholder values can also cross-reference
* other placeholders, like: * other placeholders, like:
* *
* <pre class="code">rootPath=myrootdir * <pre class="code">
* rootPath=myrootdir
* subPath=${rootPath}/subdir</pre> * subPath=${rootPath}/subdir</pre>
* *
* In contrast to {@link PropertyOverrideConfigurer}, subclasses of this type allow * In contrast to {@link PropertyOverrideConfigurer}, subclasses of this type allow
@ -71,13 +73,13 @@ import org.springframework.util.StringValueResolver;
* *
* <p>Default property values can be defined globally for each configurer instance * <p>Default property values can be defined globally for each configurer instance
* via the {@link #setProperties properties} property, or on a property-by-property basis * via the {@link #setProperties properties} property, or on a property-by-property basis
* using the default value separator which is {@code ":"} by default and * using the value separator which is {@code ":"} by default and customizable via
* customizable via {@link #setValueSeparator(String)}. * {@link #setValueSeparator(String)}.
* *
* <p>Example XML property with default value: * <p>Example XML property with default value:
* *
* <pre class="code"> * <pre class="code">
* <property name="url" value="jdbc:${dbname:defaultdb}"/> * &lt;property name="url" value="jdbc:${dbname:defaultdb}" /&gt;
* </pre> * </pre>
* *
* @author Chris Beams * @author Chris Beams

8
spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 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.
@ -71,12 +71,12 @@ import org.springframework.util.ClassUtils;
* *
* <p>Registered by default when using {@code <context:annotation-config/>} or * <p>Registered by default when using {@code <context:annotation-config/>} or
* {@code <context:component-scan/>}. Otherwise, may be declared manually as * {@code <context:component-scan/>}. Otherwise, may be declared manually as
* with any other BeanFactoryPostProcessor. * with any other {@link BeanFactoryPostProcessor}.
* *
* <p>This post processor is priority-ordered as it is important that any * <p>This post processor is priority-ordered as it is important that any
* {@link Bean} methods declared in {@code @Configuration} classes have * {@link Bean @Bean} methods declared in {@code @Configuration} classes have
* their corresponding bean definitions registered before any other * their corresponding bean definitions registered before any other
* {@link BeanFactoryPostProcessor} executes. * {@code BeanFactoryPostProcessor} executes.
* *
* @author Chris Beams * @author Chris Beams
* @author Juergen Hoeller * @author Juergen Hoeller

6
spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 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.
@ -48,13 +48,13 @@ public final class CandidateComponentsIndexLoader {
public static final String COMPONENTS_RESOURCE_LOCATION = "META-INF/spring.components"; public static final String COMPONENTS_RESOURCE_LOCATION = "META-INF/spring.components";
/** /**
* System property that instructs Spring to ignore the index, i.e. * System property that instructs Spring to ignore the components index, i.e.
* to always return {@code null} from {@link #loadIndex(ClassLoader)}. * to always return {@code null} from {@link #loadIndex(ClassLoader)}.
* <p>The default is "false", allowing for regular use of the index. Switching this * <p>The default is "false", allowing for regular use of the index. Switching this
* flag to {@code true} fulfills a corner case scenario when an index is partially * flag to {@code true} fulfills a corner case scenario when an index is partially
* available for some libraries (or use cases) but couldn't be built for the whole * available for some libraries (or use cases) but couldn't be built for the whole
* application. In this case, the application context fallbacks to a regular * application. In this case, the application context fallbacks to a regular
* classpath arrangement (i.e. as no index was present at all). * classpath arrangement (i.e. as though no index were present at all).
*/ */
public static final String IGNORE_INDEX = "spring.index.ignore"; public static final String IGNORE_INDEX = "spring.index.ignore";

6
spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 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.
@ -856,8 +856,8 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
beanFactory.getBean(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class)); beanFactory.getBean(CONVERSION_SERVICE_BEAN_NAME, ConversionService.class));
} }
// Register a default embedded value resolver if no bean post-processor // Register a default embedded value resolver if no BeanFactoryPostProcessor
// (such as a PropertyPlaceholderConfigurer bean) registered any before: // (such as a PropertySourcesPlaceholderConfigurer bean) registered any before:
// at this point, primarily for resolution in annotation attribute values. // at this point, primarily for resolution in annotation attribute values.
if (!beanFactory.hasEmbeddedValueResolver()) { if (!beanFactory.hasEmbeddedValueResolver()) {
beanFactory.addEmbeddedValueResolver(strVal -> getEnvironment().resolvePlaceholders(strVal)); beanFactory.addEmbeddedValueResolver(strVal -> getEnvironment().resolvePlaceholders(strVal));

17
spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2020 the original author or authors. * Copyright 2002-2021 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.
@ -36,14 +36,17 @@ import java.lang.annotation.Target;
* *
* <p>For ISO-based formatting, set the {@link #iso} attribute to be the desired {@link ISO} format, * <p>For ISO-based formatting, set the {@link #iso} attribute to be the desired {@link ISO} format,
* such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern} attribute to be the * such as {@link ISO#DATE}. For custom formatting, set the {@link #pattern} attribute to be the
* DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}. * DateTime pattern, such as {@code "yyyy/MM/dd hh:mm:ss a"}.
* *
* <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance * <p>Each attribute is mutually exclusive, so only set one attribute per annotation instance
* (the one most convenient one for your formatting needs). * (the one most convenient for your formatting needs).
* When the pattern attribute is specified, it takes precedence over both the style and ISO attribute. *
* When the {@link #iso} attribute is specified, it takes precedence over the style attribute. * <ul>
* When no annotation attributes are specified, the default format applied is style-based * <li>When the pattern attribute is specified, it takes precedence over both the style and ISO attribute.</li>
* with a style code of 'SS' (short date, short time). * <li>When the {@link #iso} attribute is specified, it takes precedence over the style attribute.</li>
* <li>When no annotation attributes are specified, the default format applied is style-based
* with a style code of 'SS' (short date, short time).</li>
* </ul>
* *
* @author Keith Donald * @author Keith Donald
* @author Juergen Hoeller * @author Juergen Hoeller

16
spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2018 the original author or authors. * Copyright 2002-2021 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.
@ -45,10 +45,10 @@ public abstract class TransactionSynchronizationUtils {
/** /**
* Check whether the given resource transaction managers refers to the given * Check whether the given resource transaction manager refers to the given
* (underlying) resource factory. * (underlying) resource factory.
* @see ResourceTransactionManager#getResourceFactory() * @see ResourceTransactionManager#getResourceFactory()
* @see org.springframework.core.InfrastructureProxy#getWrappedObject() * @see InfrastructureProxy#getWrappedObject()
*/ */
public static boolean sameResourceFactory(ResourceTransactionManager tm, Object resourceFactory) { public static boolean sameResourceFactory(ResourceTransactionManager tm, Object resourceFactory) {
return unwrapResourceIfNecessary(tm.getResourceFactory()).equals(unwrapResourceIfNecessary(resourceFactory)); return unwrapResourceIfNecessary(tm.getResourceFactory()).equals(unwrapResourceIfNecessary(resourceFactory));
@ -57,7 +57,7 @@ public abstract class TransactionSynchronizationUtils {
/** /**
* Unwrap the given resource handle if necessary; otherwise return * Unwrap the given resource handle if necessary; otherwise return
* the given handle as-is. * the given handle as-is.
* @see org.springframework.core.InfrastructureProxy#getWrappedObject() * @see InfrastructureProxy#getWrappedObject()
*/ */
static Object unwrapResourceIfNecessary(Object resource) { static Object unwrapResourceIfNecessary(Object resource) {
Assert.notNull(resource, "Resource must not be null"); Assert.notNull(resource, "Resource must not be null");
@ -106,8 +106,8 @@ public abstract class TransactionSynchronizationUtils {
try { try {
synchronization.beforeCompletion(); synchronization.beforeCompletion();
} }
catch (Throwable tsex) { catch (Throwable ex) {
logger.error("TransactionSynchronization.beforeCompletion threw exception", tsex); logger.error("TransactionSynchronization.beforeCompletion threw exception", ex);
} }
} }
} }
@ -170,8 +170,8 @@ public abstract class TransactionSynchronizationUtils {
try { try {
synchronization.afterCompletion(completionStatus); synchronization.afterCompletion(completionStatus);
} }
catch (Throwable tsex) { catch (Throwable ex) {
logger.error("TransactionSynchronization.afterCompletion threw exception", tsex); logger.error("TransactionSynchronization.afterCompletion threw exception", ex);
} }
} }
} }

Loading…
Cancel
Save