From dd3262bfe30c2533cdfb0b24a26a341edefb5d0d Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Thu, 25 Feb 2021 19:08:53 +0100 Subject: [PATCH] Polishing (backported from master) --- .../aop/DynamicIntroductionAdvice.java | 4 ++-- .../config/PlaceholderConfigurerSupport.java | 20 ++++++++++--------- .../ConfigurationClassPostProcessor.java | 8 ++++---- .../index/CandidateComponentsIndexLoader.java | 6 +++--- .../support/AbstractApplicationContext.java | 6 +++--- .../format/annotation/DateTimeFormat.java | 17 +++++++++------- .../TransactionSynchronizationUtils.java | 16 +++++++-------- 7 files changed, 41 insertions(+), 36 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java b/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java index 08c704857f7..2f46775b945 100644 --- a/spring-aop/src/main/java/org/springframework/aop/DynamicIntroductionAdvice.java +++ b/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"); * you may not use this file except in compliance with the License. @@ -26,7 +26,7 @@ import org.aopalliance.aop.Advice; *

Introductions are often mixins, enabling the building of composite * objects that can achieve many of the goals of multiple inheritance in Java. * - *

Compared to {qlink IntroductionInfo}, this interface allows an advice to + *

Compared to {@link IntroductionInfo}, this interface allows an advice to * implement a range of interfaces that is not necessarily known in advance. * Thus an {@link IntroductionAdvisor} can be used to specify which interfaces * will be exposed in an advised object. diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java b/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java index fc29a9eda99..9a11f7af3ff 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/config/PlaceholderConfigurerSupport.java +++ b/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"); * 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: * *

- * <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"/>
- *   <property name="driverClassName" value="${driver}"/>
- *   <property name="url" value="jdbc:${dbname}"/>
+ * <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+ *   <property name="driverClassName" value="${driver}" />
+ *   <property name="url" value="jdbc:${dbname}" />
  * </bean>
  * 
* * Example properties file: * - *
driver=com.mysql.jdbc.Driver
+ * 
+ * driver=com.mysql.jdbc.Driver
  * dbname=mysql:mydb
* * 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 * other placeholders, like: * - *
rootPath=myrootdir
+ * 
+ * rootPath=myrootdir
  * subPath=${rootPath}/subdir
* * In contrast to {@link PropertyOverrideConfigurer}, subclasses of this type allow @@ -71,13 +73,13 @@ import org.springframework.util.StringValueResolver; * *

Default property values can be defined globally for each configurer instance * via the {@link #setProperties properties} property, or on a property-by-property basis - * using the default value separator which is {@code ":"} by default and - * customizable via {@link #setValueSeparator(String)}. + * using the value separator which is {@code ":"} by default and customizable via + * {@link #setValueSeparator(String)}. * *

Example XML property with default value: * *

- *   
+ *   <property name="url" value="jdbc:${dbname:defaultdb}" />
  * 
* * @author Chris Beams diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java b/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java index ad6e2fab124..348ad103fda 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassPostProcessor.java +++ b/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"); * you may not use this file except in compliance with the License. @@ -71,12 +71,12 @@ import org.springframework.util.ClassUtils; * *

Registered by default when using {@code } or * {@code }. Otherwise, may be declared manually as - * with any other BeanFactoryPostProcessor. + * with any other {@link BeanFactoryPostProcessor}. * *

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 - * {@link BeanFactoryPostProcessor} executes. + * {@code BeanFactoryPostProcessor} executes. * * @author Chris Beams * @author Juergen Hoeller diff --git a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java b/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java index fcca537891a..af068373d8c 100644 --- a/spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndexLoader.java +++ b/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"); * 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"; /** - * 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)}. *

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 * 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 - * 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"; diff --git a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java b/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java index 933fc7359cb..83be8cdd2b9 100644 --- a/spring-context/src/main/java/org/springframework/context/support/AbstractApplicationContext.java +++ b/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"); * 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)); } - // Register a default embedded value resolver if no bean post-processor - // (such as a PropertyPlaceholderConfigurer bean) registered any before: + // Register a default embedded value resolver if no BeanFactoryPostProcessor + // (such as a PropertySourcesPlaceholderConfigurer bean) registered any before: // at this point, primarily for resolution in annotation attribute values. if (!beanFactory.hasEmbeddedValueResolver()) { beanFactory.addEmbeddedValueResolver(strVal -> getEnvironment().resolvePlaceholders(strVal)); diff --git a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java b/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java index 488e78d7da8..0b3b3514055 100644 --- a/spring-context/src/main/java/org/springframework/format/annotation/DateTimeFormat.java +++ b/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"); * you may not use this file except in compliance with the License. @@ -36,14 +36,17 @@ import java.lang.annotation.Target; * *

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 - * DateTime pattern, such as {@code yyyy/MM/dd hh:mm:ss a}. + * DateTime pattern, such as {@code "yyyy/MM/dd hh:mm:ss a"}. * *

Each attribute is mutually exclusive, so only set one attribute per annotation instance - * (the one most convenient one 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. - * When no annotation attributes are specified, the default format applied is style-based - * with a style code of 'SS' (short date, short time). + * (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.
  • + *
  • When no annotation attributes are specified, the default format applied is style-based + * with a style code of 'SS' (short date, short time).
  • + *
* * @author Keith Donald * @author Juergen Hoeller diff --git a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java b/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java index e91d1bc2784..d7df9ad6128 100644 --- a/spring-tx/src/main/java/org/springframework/transaction/support/TransactionSynchronizationUtils.java +++ b/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"); * 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. * @see ResourceTransactionManager#getResourceFactory() - * @see org.springframework.core.InfrastructureProxy#getWrappedObject() + * @see InfrastructureProxy#getWrappedObject() */ public static boolean sameResourceFactory(ResourceTransactionManager tm, Object 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 * the given handle as-is. - * @see org.springframework.core.InfrastructureProxy#getWrappedObject() + * @see InfrastructureProxy#getWrappedObject() */ static Object unwrapResourceIfNecessary(Object resource) { Assert.notNull(resource, "Resource must not be null"); @@ -106,8 +106,8 @@ public abstract class TransactionSynchronizationUtils { try { synchronization.beforeCompletion(); } - catch (Throwable tsex) { - logger.error("TransactionSynchronization.beforeCompletion threw exception", tsex); + catch (Throwable ex) { + logger.error("TransactionSynchronization.beforeCompletion threw exception", ex); } } } @@ -170,8 +170,8 @@ public abstract class TransactionSynchronizationUtils { try { synchronization.afterCompletion(completionStatus); } - catch (Throwable tsex) { - logger.error("TransactionSynchronization.afterCompletion threw exception", tsex); + catch (Throwable ex) { + logger.error("TransactionSynchronization.afterCompletion threw exception", ex); } } }