Skip to content

Commit 701e9e4

Browse files
committed
Polishing
1 parent ce385d1 commit 701e9e4

File tree

17 files changed

+98
-105
lines changed

17 files changed

+98
-105
lines changed

spring-beans/src/main/java/org/springframework/beans/factory/support/ConstructorResolver.java

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -600,13 +600,10 @@ else if (resolvedValues != null) {
600600
String argDesc = StringUtils.collectionToCommaDelimitedString(argTypes);
601601
throw new BeanCreationException(mbd.getResourceDescription(), beanName,
602602
"No matching factory method found on class [" + factoryClass.getName() + "]: " +
603-
(mbd.getFactoryBeanName() != null ?
604-
"factory bean '" + mbd.getFactoryBeanName() + "'; " : "") +
603+
(mbd.getFactoryBeanName() != null ? "factory bean '" + mbd.getFactoryBeanName() + "'; " : "") +
605604
"factory method '" + mbd.getFactoryMethodName() + "(" + argDesc + ")'. " +
606-
"Check that a method with the specified name " +
607-
(minNrOfArgs > 0 ? "and arguments " : "") +
608-
"exists and that it is " +
609-
(isStatic ? "static" : "non-static") + ".");
605+
"Check that a method with the specified name " + (minNrOfArgs > 0 ? "and arguments " : "") +
606+
"exists and that it is " + (isStatic ? "static" : "non-static") + ".");
610607
}
611608
else if (void.class == factoryMethodToUse.getReturnType()) {
612609
throw new BeanCreationException(mbd.getResourceDescription(), beanName,

spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultSingletonBeanRegistry.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -567,16 +567,16 @@ public void destroySingleton(String beanName) {
567567
*/
568568
protected void destroyBean(String beanName, @Nullable DisposableBean bean) {
569569
// Trigger destruction of dependent beans first...
570-
Set<String> dependencies;
570+
Set<String> dependentBeanNames;
571571
synchronized (this.dependentBeanMap) {
572572
// Within full synchronization in order to guarantee a disconnected Set
573-
dependencies = this.dependentBeanMap.remove(beanName);
573+
dependentBeanNames = this.dependentBeanMap.remove(beanName);
574574
}
575-
if (dependencies != null) {
575+
if (dependentBeanNames != null) {
576576
if (logger.isTraceEnabled()) {
577-
logger.trace("Retrieved dependent beans for bean '" + beanName + "': " + dependencies);
577+
logger.trace("Retrieved dependent beans for bean '" + beanName + "': " + dependentBeanNames);
578578
}
579-
for (String dependentBeanName : dependencies) {
579+
for (String dependentBeanName : dependentBeanNames) {
580580
destroySingleton(dependentBeanName);
581581
}
582582
}

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClass.java

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -72,7 +72,6 @@ final class ConfigurationClass {
7272
* Create a new {@link ConfigurationClass} with the given name.
7373
* @param metadataReader reader used to parse the underlying {@link Class}
7474
* @param beanName must not be {@code null}
75-
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
7675
*/
7776
ConfigurationClass(MetadataReader metadataReader, String beanName) {
7877
Assert.notNull(beanName, "Bean name must not be null");
@@ -86,10 +85,10 @@ final class ConfigurationClass {
8685
* using the {@link Import} annotation or automatically processed as a nested
8786
* configuration class (if importedBy is not {@code null}).
8887
* @param metadataReader reader used to parse the underlying {@link Class}
89-
* @param importedBy the configuration class importing this one or {@code null}
88+
* @param importedBy the configuration class importing this one
9089
* @since 3.1.1
9190
*/
92-
ConfigurationClass(MetadataReader metadataReader, @Nullable ConfigurationClass importedBy) {
91+
ConfigurationClass(MetadataReader metadataReader, ConfigurationClass importedBy) {
9392
this.metadata = metadataReader.getAnnotationMetadata();
9493
this.resource = metadataReader.getResource();
9594
this.importedBy.add(importedBy);
@@ -99,7 +98,6 @@ final class ConfigurationClass {
9998
* Create a new {@link ConfigurationClass} with the given name.
10099
* @param clazz the underlying {@link Class} to represent
101100
* @param beanName name of the {@code @Configuration} class bean
102-
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
103101
*/
104102
ConfigurationClass(Class<?> clazz, String beanName) {
105103
Assert.notNull(beanName, "Bean name must not be null");
@@ -113,10 +111,10 @@ final class ConfigurationClass {
113111
* using the {@link Import} annotation or automatically processed as a nested
114112
* configuration class (if imported is {@code true}).
115113
* @param clazz the underlying {@link Class} to represent
116-
* @param importedBy the configuration class importing this one (or {@code null})
114+
* @param importedBy the configuration class importing this one
117115
* @since 3.1.1
118116
*/
119-
ConfigurationClass(Class<?> clazz, @Nullable ConfigurationClass importedBy) {
117+
ConfigurationClass(Class<?> clazz, ConfigurationClass importedBy) {
120118
this.metadata = AnnotationMetadata.introspect(clazz);
121119
this.resource = new DescriptiveResource(clazz.getName());
122120
this.importedBy.add(importedBy);
@@ -126,7 +124,6 @@ final class ConfigurationClass {
126124
* Create a new {@link ConfigurationClass} with the given name.
127125
* @param metadata the metadata for the underlying class to represent
128126
* @param beanName name of the {@code @Configuration} class bean
129-
* @see ConfigurationClass#ConfigurationClass(Class, ConfigurationClass)
130127
*/
131128
ConfigurationClass(AnnotationMetadata metadata, String beanName) {
132129
Assert.notNull(beanName, "Bean name must not be null");
@@ -148,12 +145,12 @@ String getSimpleName() {
148145
return ClassUtils.getShortName(getMetadata().getClassName());
149146
}
150147

151-
void setBeanName(String beanName) {
148+
void setBeanName(@Nullable String beanName) {
152149
this.beanName = beanName;
153150
}
154151

155152
@Nullable
156-
public String getBeanName() {
153+
String getBeanName() {
157154
return this.beanName;
158155
}
159156

@@ -163,7 +160,7 @@ public String getBeanName() {
163160
* @since 3.1.1
164161
* @see #getImportedBy()
165162
*/
166-
public boolean isImported() {
163+
boolean isImported() {
167164
return !this.importedBy.isEmpty();
168165
}
169166

@@ -197,6 +194,10 @@ void addImportedResource(String importedResource, Class<? extends BeanDefinition
197194
this.importedResources.put(importedResource, readerClass);
198195
}
199196

197+
Map<String, Class<? extends BeanDefinitionReader>> getImportedResources() {
198+
return this.importedResources;
199+
}
200+
200201
void addImportBeanDefinitionRegistrar(ImportBeanDefinitionRegistrar registrar, AnnotationMetadata importingClassMetadata) {
201202
this.importBeanDefinitionRegistrars.put(registrar, importingClassMetadata);
202203
}
@@ -205,10 +206,6 @@ Map<ImportBeanDefinitionRegistrar, AnnotationMetadata> getImportBeanDefinitionRe
205206
return this.importBeanDefinitionRegistrars;
206207
}
207208

208-
Map<String, Class<? extends BeanDefinitionReader>> getImportedResources() {
209-
return this.importedResources;
210-
}
211-
212209
void validate(ProblemReporter problemReporter) {
213210
// A configuration class may not be final (CGLIB limitation) unless it declares proxyBeanMethods=false
214211
Map<String, Object> attributes = this.metadata.getAnnotationAttributes(Configuration.class.getName());

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

Lines changed: 24 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2023 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -136,17 +136,6 @@
136136
public abstract class AbstractApplicationContext extends DefaultResourceLoader
137137
implements ConfigurableApplicationContext {
138138

139-
/**
140-
* The name of the {@link LifecycleProcessor} bean in the context.
141-
* If none is supplied, a {@link DefaultLifecycleProcessor} is used.
142-
* @since 3.0
143-
* @see org.springframework.context.LifecycleProcessor
144-
* @see org.springframework.context.support.DefaultLifecycleProcessor
145-
* @see #start()
146-
* @see #stop()
147-
*/
148-
public static final String LIFECYCLE_PROCESSOR_BEAN_NAME = "lifecycleProcessor";
149-
150139
/**
151140
* The name of the {@link MessageSource} bean in the context.
152141
* If none is supplied, message resolution is delegated to the parent.
@@ -167,6 +156,18 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
167156
*/
168157
public static final String APPLICATION_EVENT_MULTICASTER_BEAN_NAME = "applicationEventMulticaster";
169158

159+
/**
160+
* The name of the {@link LifecycleProcessor} bean in the context.
161+
* If none is supplied, a {@link DefaultLifecycleProcessor} is used.
162+
* @since 3.0
163+
* @see org.springframework.context.LifecycleProcessor
164+
* @see org.springframework.context.support.DefaultLifecycleProcessor
165+
* @see #start()
166+
* @see #stop()
167+
*/
168+
public static final String LIFECYCLE_PROCESSOR_BEAN_NAME = "lifecycleProcessor";
169+
170+
170171
/**
171172
* Boolean flag controlled by a {@code spring.spel.ignore} system property that
172173
* instructs Spring to ignore SpEL, i.e. to not initialize the SpEL infrastructure.
@@ -570,7 +571,6 @@ public void refresh() throws BeansException, IllegalStateException {
570571
StartupStep beanPostProcess = this.applicationStartup.start("spring.context.beans.post-process");
571572
// Invoke factory processors registered as beans in the context.
572573
invokeBeanFactoryPostProcessors(beanFactory);
573-
574574
// Register bean processors that intercept bean creation.
575575
registerBeanPostProcessors(beanFactory);
576576
beanPostProcess.end();
@@ -774,8 +774,9 @@ protected void registerBeanPostProcessors(ConfigurableListableBeanFactory beanFa
774774
}
775775

776776
/**
777-
* Initialize the MessageSource.
778-
* Use parent's if none defined in this context.
777+
* Initialize the {@link MessageSource}.
778+
* <p>Uses parent's {@code MessageSource} if none defined in this context.
779+
* @see #MESSAGE_SOURCE_BEAN_NAME
779780
*/
780781
protected void initMessageSource() {
781782
ConfigurableListableBeanFactory beanFactory = getBeanFactory();
@@ -807,8 +808,9 @@ protected void initMessageSource() {
807808
}
808809

809810
/**
810-
* Initialize the ApplicationEventMulticaster.
811-
* Uses SimpleApplicationEventMulticaster if none defined in the context.
811+
* Initialize the {@link ApplicationEventMulticaster}.
812+
* <p>Uses {@link SimpleApplicationEventMulticaster} if none defined in the context.
813+
* @see #APPLICATION_EVENT_MULTICASTER_BEAN_NAME
812814
* @see org.springframework.context.event.SimpleApplicationEventMulticaster
813815
*/
814816
protected void initApplicationEventMulticaster() {
@@ -831,15 +833,16 @@ protected void initApplicationEventMulticaster() {
831833
}
832834

833835
/**
834-
* Initialize the LifecycleProcessor.
835-
* Uses DefaultLifecycleProcessor if none defined in the context.
836+
* Initialize the {@link LifecycleProcessor}.
837+
* <p>Uses {@link DefaultLifecycleProcessor} if none defined in the context.
838+
* @since 3.0
839+
* @see #LIFECYCLE_PROCESSOR_BEAN_NAME
836840
* @see org.springframework.context.support.DefaultLifecycleProcessor
837841
*/
838842
protected void initLifecycleProcessor() {
839843
ConfigurableListableBeanFactory beanFactory = getBeanFactory();
840844
if (beanFactory.containsLocalBean(LIFECYCLE_PROCESSOR_BEAN_NAME)) {
841-
this.lifecycleProcessor =
842-
beanFactory.getBean(LIFECYCLE_PROCESSOR_BEAN_NAME, LifecycleProcessor.class);
845+
this.lifecycleProcessor = beanFactory.getBean(LIFECYCLE_PROCESSOR_BEAN_NAME, LifecycleProcessor.class);
843846
if (logger.isTraceEnabled()) {
844847
logger.trace("Using LifecycleProcessor [" + this.lifecycleProcessor + "]");
845848
}

spring-jdbc/src/main/java/org/springframework/jdbc/IncorrectResultSetColumnCountException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* Data access exception thrown when a result set did not have the correct column count,
23-
* for example when expecting a single column but getting 0 or more than 1 columns.
23+
* for example when expecting a single column but getting 0 or more than 1 column.
2424
*
2525
* @author Juergen Hoeller
2626
* @since 2.0

spring-jdbc/src/main/java/org/springframework/jdbc/JdbcUpdateAffectedIncorrectNumberOfRowsException.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2018 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
2020

2121
/**
2222
* Exception thrown when a JDBC update affects an unexpected number of rows.
23-
* Typically we expect an update to affect a single row, meaning it's an
23+
* Typically, we expect an update to affect a single row, meaning it is an
2424
* error if it affects multiple rows.
2525
*
2626
* @author Rod Johnson

spring-jdbc/src/main/java/org/springframework/jdbc/core/InterruptibleBatchPreparedStatementSetter.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2012 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,7 +22,7 @@
2222
*
2323
* <p>This interface allows you to signal the end of a batch rather than
2424
* having to determine the exact batch size upfront. Batch size is still
25-
* being honored but it is now the maximum size of the batch.
25+
* being honored, but it is now the maximum size of the batch.
2626
*
2727
* <p>The {@link #isBatchExhausted} method is called after each call to
2828
* {@link #setValues} to determine whether there were some values added,

spring-jdbc/src/main/java/org/springframework/jdbc/object/RdbmsOperation.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2020 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -128,8 +128,8 @@ public void setFetchSize(int fetchSize) {
128128

129129
/**
130130
* Set the maximum number of rows for this RDBMS operation. This is important
131-
* for processing subsets of large result sets, avoiding to read and hold
132-
* the entire result set in the database or in the JDBC driver.
131+
* for processing subsets of large result sets, in order to avoid reading and
132+
* holding the entire result set in the database or in the JDBC driver.
133133
* <p>Default is -1, indicating to use the driver's default.
134134
* @see org.springframework.jdbc.core.JdbcTemplate#setMaxRows
135135
*/
@@ -175,7 +175,7 @@ public int getResultSetType() {
175175
public void setUpdatableResults(boolean updatableResults) {
176176
if (isCompiled()) {
177177
throw new InvalidDataAccessApiUsageException(
178-
"The updateableResults flag must be set before the operation is compiled");
178+
"The updatableResults flag must be set before the operation is compiled");
179179
}
180180
this.updatableResults = updatableResults;
181181
}

spring-jdbc/src/main/java/org/springframework/jdbc/object/StoredProcedure.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2021 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
2929

3030
/**
3131
* Superclass for object abstractions of RDBMS stored procedures.
32-
* This class is abstract and it is intended that subclasses will provide a typed
32+
* This class is abstract, and it is intended that subclasses will provide a typed
3333
* method for invocation that delegates to the supplied {@link #execute} method.
3434
*
3535
* <p>The inherited {@link #setSql sql} property is the name of the stored procedure

spring-jdbc/src/main/java/org/springframework/jdbc/support/CustomSQLExceptionTranslatorRegistry.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2019 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -25,9 +25,9 @@
2525
import org.springframework.lang.Nullable;
2626

2727
/**
28-
* Registry for custom {@link org.springframework.jdbc.support.SQLExceptionTranslator} instances associated with
29-
* specific databases allowing for overriding translation based on values contained in the configuration file
30-
* named "sql-error-codes.xml".
28+
* Registry for custom {@link SQLExceptionTranslator} instances associated with
29+
* specific databases allowing for overriding translation based on values
30+
* contained in the configuration file named "sql-error-codes.xml".
3131
*
3232
* @author Thomas Risberg
3333
* @since 3.1.1
@@ -38,7 +38,7 @@ public final class CustomSQLExceptionTranslatorRegistry {
3838
private static final Log logger = LogFactory.getLog(CustomSQLExceptionTranslatorRegistry.class);
3939

4040
/**
41-
* Keep track of a single instance so we can return it to classes that request it.
41+
* Keep track of a single instance, so we can return it to classes that request it.
4242
*/
4343
private static final CustomSQLExceptionTranslatorRegistry instance = new CustomSQLExceptionTranslatorRegistry();
4444

0 commit comments

Comments
 (0)