Skip to content

Commit 40d5196

Browse files
committed
Polishing
1 parent ec2c9b5 commit 40d5196

File tree

4 files changed

+17
-16
lines changed

4 files changed

+17
-16
lines changed

framework-docs/modules/ROOT/pages/data-access/orm/jpa.adoc

+5-5
Original file line numberDiff line numberDiff line change
@@ -268,8 +268,8 @@ The actual JPA provider bootstrapping is handed off to the specified executor an
268268
running in parallel, to the application bootstrap thread. The exposed `EntityManagerFactory`
269269
proxy can be injected into other application components and is even able to respond to
270270
`EntityManagerFactoryInfo` configuration inspection. However, once the actual JPA provider
271-
is being accessed by other components (for example, calling `createEntityManager`), those calls
272-
block until the background bootstrapping has completed. In particular, when you use
271+
is being accessed by other components (for example, calling `createEntityManager`), those
272+
calls block until the background bootstrapping has completed. In particular, when you use
273273
Spring Data JPA, make sure to set up deferred bootstrapping for its repositories as well.
274274

275275

@@ -284,9 +284,9 @@ to a newly created `EntityManager` per operation, in effect making its usage thr
284284

285285
It is possible to write code against the plain JPA without any Spring dependencies, by
286286
using an injected `EntityManagerFactory` or `EntityManager`. Spring can understand the
287-
`@PersistenceUnit` and `@PersistenceContext` annotations both at the field and the method level
288-
if a `PersistenceAnnotationBeanPostProcessor` is enabled. The following example shows a plain
289-
JPA DAO implementation that uses the `@PersistenceUnit` annotation:
287+
`@PersistenceUnit` and `@PersistenceContext` annotations both at the field and the method
288+
level if a `PersistenceAnnotationBeanPostProcessor` is enabled. The following example
289+
shows a plain JPA DAO implementation that uses the `@PersistenceUnit` annotation:
290290

291291
[tabs]
292292
======

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

164+
/** Application startup metrics. **/
165+
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
166+
164167
/** Map from bean name to merged RootBeanDefinition. */
165168
private final Map<String, RootBeanDefinition> mergedBeanDefinitions = new ConcurrentHashMap<>(256);
166169

@@ -171,8 +174,6 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
171174
private final ThreadLocal<Object> prototypesCurrentlyInCreation =
172175
new NamedThreadLocal<>("Prototype beans currently in creation");
173176

174-
/** Application startup metrics. **/
175-
private ApplicationStartup applicationStartup = ApplicationStartup.DEFAULT;
176177

177178
/**
178179
* 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

+6-7
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.
@@ -557,7 +557,7 @@ protected Resource[] findPathMatchingResources(String locationPattern) throws IO
557557
String rootDirPath = determineRootDir(locationPattern);
558558
String subPattern = locationPattern.substring(rootDirPath.length());
559559
Resource[] rootDirResources = getResources(rootDirPath);
560-
Set<Resource> result = new LinkedHashSet<>(16);
560+
Set<Resource> result = new LinkedHashSet<>(64);
561561
for (Resource rootDirResource : rootDirResources) {
562562
rootDirResource = resolveRootDirResource(rootDirResource);
563563
URL rootDirUrl = rootDirResource.getURL();
@@ -706,7 +706,7 @@ protected Set<Resource> doFindPathMatchingJarResources(Resource rootDirResource,
706706
// The Sun JRE does not return a slash here, but BEA JRockit does.
707707
rootEntryPath = rootEntryPath + "/";
708708
}
709-
Set<Resource> result = new LinkedHashSet<>(8);
709+
Set<Resource> result = new LinkedHashSet<>(64);
710710
for (Enumeration<JarEntry> entries = jarFile.entries(); entries.hasMoreElements();) {
711711
JarEntry entry = entries.nextElement();
712712
String entryPath = entry.getName();
@@ -756,7 +756,7 @@ protected JarFile getJarFile(String jarFileUrl) throws IOException {
756756
protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource, String subPattern)
757757
throws IOException {
758758

759-
Set<Resource> result = new LinkedHashSet<>();
759+
Set<Resource> result = new LinkedHashSet<>(64);
760760
URI rootDirUri;
761761
try {
762762
rootDirUri = rootDirResource.getURI();
@@ -865,7 +865,7 @@ protected Set<Resource> doFindPathMatchingFileResources(Resource rootDirResource
865865
* @see PathMatcher#match(String, String)
866866
*/
867867
protected Set<Resource> findAllModulePathResources(String locationPattern) throws IOException {
868-
Set<Resource> result = new LinkedHashSet<>(16);
868+
Set<Resource> result = new LinkedHashSet<>(64);
869869

870870
// Skip scanning the module path when running in a native image.
871871
if (NativeDetector.inNativeImage()) {
@@ -966,7 +966,7 @@ private static class PatternVirtualFileVisitor implements InvocationHandler {
966966

967967
private final String rootPath;
968968

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

971971
public PatternVirtualFileVisitor(String rootPath, String subPattern, PathMatcher pathMatcher) {
972972
this.subPattern = subPattern;
@@ -997,7 +997,6 @@ else if ("visit".equals(methodName)) {
997997
else if ("toString".equals(methodName)) {
998998
return toString();
999999
}
1000-
10011000
throw new IllegalStateException("Unexpected method invocation: " + method);
10021001
}
10031002

0 commit comments

Comments
 (0)