Skip to content

Commit 915d5bd

Browse files
committed
Polishing
1 parent dc86fea commit 915d5bd

File tree

3 files changed

+10
-9
lines changed

3 files changed

+10
-9
lines changed

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

+4-3
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.
@@ -166,6 +166,9 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
166166
/** Map from scope identifier String to corresponding Scope. */
167167
private final Map<String, Scope> scopes = new LinkedHashMap<>(8);
168168

169+
/** Application startup metrics. **/
170+
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
171+
169172
/** Security context used when running with a SecurityManager. */
170173
@Nullable
171174
private SecurityContextProvider securityContextProvider;
@@ -180,8 +183,6 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
180183
private final ThreadLocal<Object> prototypesCurrentlyInCreation =
181184
new NamedThreadLocal<>("Prototype beans currently in creation");
182185

183-
/** Application startup metrics. **/
184-
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
185186

186187
/**
187188
* Create a new AbstractBeanFactory.

spring-context/src/test/java/org/springframework/context/annotation/ClassPathBeanDefinitionScannerTests.java

+2-1
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.
@@ -268,6 +268,7 @@ public void testSimpleScanWithDefaultFiltersAndSpecifiedBeanNameClash() {
268268
ClassPathBeanDefinitionScanner scanner = new ClassPathBeanDefinitionScanner(context);
269269
scanner.setIncludeAnnotationConfig(false);
270270
scanner.scan("org.springframework.context.annotation2");
271+
271272
assertThatIllegalStateException().isThrownBy(() -> scanner.scan(BASE_PACKAGE))
272273
.withMessageContaining("myNamedDao")
273274
.withMessageContaining(NamedStubDao.class.getName())

spring-core/src/main/java/org/springframework/core/io/support/PathMatchingResourcePatternResolver.java

+4-5
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.
@@ -496,7 +496,7 @@ protected Resource[] findPathMatchingResources(String locationPattern) throws IO
496496
String rootDirPath = determineRootDir(locationPattern);
497497
String subPattern = locationPattern.substring(rootDirPath.length());
498498
Resource[] rootDirResources = getResources(rootDirPath);
499-
Set<Resource> result = new LinkedHashSet<>(16);
499+
Set<Resource> result = new LinkedHashSet<>(64);
500500
for (Resource rootDirResource : rootDirResources) {
501501
rootDirResource = resolveRootDirResource(rootDirResource);
502502
URL rootDirUrl = rootDirResource.getURL();
@@ -648,7 +648,7 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
648648
// The Sun JRE does not return a slash here, but BEA JRockit does.
649649
rootEntryPath = rootEntryPath + "/";
650650
}
651-
Set<Resource> result = new LinkedHashSet<>(8);
651+
Set<Resource> result = new LinkedHashSet<>(64);
652652
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
653653
JarEntry entry = entries.nextElement();
654654
String entryPath = entry.getName();
@@ -864,7 +864,7 @@ private static class PatternVirtualFileVisitor implements InvocationHandler {
864864

865865
private final String rootPath;
866866

867-
private final Set<Resource> resources = new LinkedHashSet<>();
867+
private final Set<Resource> resources = new LinkedHashSet<>(64);
868868

869869
public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher pathMatcher) {
870870
this.subPattern = subPattern;
@@ -895,7 +895,6 @@ else if ("visit".equals(methodName)) {
895895
else if ("toString".equals(methodName)) {
896896
return toString();
897897
}
898-
899898
throw new IllegalStateException("Unexpected method invocation: " + method);
900899
}
901900

0 commit comments

Comments
 (0)