Skip to content

Commit 6a1ec0e

Browse files
committed
Merge branch '6.1.x'
2 parents b965336 + ec1f5ca commit 6a1ec0e

File tree

5 files changed

+15
-16
lines changed

5 files changed

+15
-16
lines changed

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 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.
@@ -225,7 +225,6 @@ public void end_class() {
225225
};
226226
return new TransformingClassGenerator(cg, transformer);
227227
}
228-
229228
}
230229

231230

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,11 @@ else if (ConfigurationClassUtils.checkConfigurationClassCandidate(beanDef, this.
388388
});
389389

390390
// Detect any custom bean name generation strategy supplied through the enclosing application context
391-
SingletonBeanRegistry sbr = null;
392-
if (registry instanceof SingletonBeanRegistry _sbr) {
393-
sbr = _sbr;
391+
SingletonBeanRegistry singletonRegistry = null;
392+
if (registry instanceof SingletonBeanRegistry sbr) {
393+
singletonRegistry = sbr;
394394
if (!this.localBeanNameGeneratorSet) {
395-
BeanNameGenerator generator = (BeanNameGenerator) sbr.getSingleton(
395+
BeanNameGenerator generator = (BeanNameGenerator) singletonRegistry.getSingleton(
396396
AnnotationConfigUtils.CONFIGURATION_BEAN_NAME_GENERATOR);
397397
if (generator != null) {
398398
this.componentScanBeanNameGenerator = generator;
@@ -453,8 +453,8 @@ else if (ConfigurationClassUtils.checkConfigurationClassCandidate(beanDef, this.
453453
while (!candidates.isEmpty());
454454

455455
// Register the ImportRegistry as a bean in order to support ImportAware @Configuration classes
456-
if (sbr != null && !sbr.containsSingleton(IMPORT_REGISTRY_BEAN_NAME)) {
457-
sbr.registerSingleton(IMPORT_REGISTRY_BEAN_NAME, parser.getImportRegistry());
456+
if (singletonRegistry != null && !singletonRegistry.containsSingleton(IMPORT_REGISTRY_BEAN_NAME)) {
457+
singletonRegistry.registerSingleton(IMPORT_REGISTRY_BEAN_NAME, parser.getImportRegistry());
458458
}
459459

460460
// Store the PropertySourceDescriptors to contribute them Ahead-of-time if necessary

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ void applyToWhenHasImportAwareConfigurationRegistersBeanPostProcessorWithMapEntr
101101
initializer.accept(freshBeanFactory);
102102
freshContext.refresh();
103103
assertThat(freshBeanFactory.getBeanPostProcessors()).filteredOn(ImportAwareAotBeanPostProcessor.class::isInstance)
104-
.singleElement().satisfies(postProcessor -> assertPostProcessorEntry(postProcessor, ImportAwareConfiguration.class,
105-
ImportConfiguration.class));
104+
.singleElement().satisfies(postProcessor ->
105+
assertPostProcessorEntry(postProcessor, ImportAwareConfiguration.class, ImportConfiguration.class));
106106
freshContext.close();
107107
});
108108
}
@@ -245,6 +245,7 @@ public void afterPropertiesSet() {
245245
}
246246
}
247247

248+
248249
@Nested
249250
class PropertySourceTests {
250251

@@ -410,9 +411,9 @@ static class PropertySourceWithClassPathStarLocationPatternConfiguration {
410411
@PropertySource("classpath:org/springframework/context/annotation/p?.properties")
411412
static class PropertySourceWithWildcardLocationPatternConfiguration {
412413
}
413-
414414
}
415415

416+
416417
@Nested
417418
class ConfigurationClassProxyTests {
418419

@@ -432,15 +433,14 @@ void processAheadOfTimeFullConfigurationClass() {
432433
getRegisteredBean(CglibConfiguration.class))).isNotNull();
433434
}
434435

435-
436436
private RegisteredBean getRegisteredBean(Class<?> bean) {
437437
this.beanFactory.registerBeanDefinition("test", new RootBeanDefinition(bean));
438438
this.processor.postProcessBeanFactory(this.beanFactory);
439439
return RegisteredBean.of(this.beanFactory, "test");
440440
}
441-
442441
}
443442

443+
444444
@Nullable
445445
private BeanFactoryInitializationAotContribution getContribution(Class<?>... types) {
446446
DefaultListableBeanFactory beanFactory = new DefaultListableBeanFactory();
@@ -458,8 +458,8 @@ private void assertPostProcessorEntry(BeanPostProcessor postProcessor, Class<?>
458458
.containsExactly(entry(key.getName(), value.getName()));
459459
}
460460

461-
static class CustomPropertySourcesFactory extends DefaultPropertySourceFactory {
462461

462+
static class CustomPropertySourcesFactory extends DefaultPropertySourceFactory {
463463
}
464464

465465
}

spring-core/src/main/java/org/springframework/cglib/core/ReflectUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ private ReflectUtils() {
7575
Throwable throwable = null;
7676
try {
7777
classLoaderDefineClass = ClassLoader.class.getDeclaredMethod("defineClass",
78-
String.class, byte[].class, Integer.TYPE, Integer.TYPE, ProtectionDomain.class);
78+
String.class, byte[].class, Integer.TYPE, Integer.TYPE, ProtectionDomain.class);
7979
}
8080
catch (Throwable t) {
8181
classLoaderDefineClass = null;

spring-core/src/main/java/org/springframework/cglib/proxy/MethodProxy.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ public static MethodProxy create(Class c1, Class c2, String desc, String name1,
5757
proxy.createInfo = new CreateInfo(c1, c2);
5858

5959
// SPRING PATCH BEGIN
60-
if (!c1.isInterface() && c1 != Object.class && !Factory.class.isAssignableFrom(c2)) {
60+
if (c1 != Object.class && c1.isAssignableFrom(c2.getSuperclass()) && !Factory.class.isAssignableFrom(c2)) {
6161
// Try early initialization for overridden methods on specifically purposed subclasses
6262
try {
6363
proxy.init();

0 commit comments

Comments
 (0)