Merge branch '5.3.x'

# Conflicts:
#	build.gradle
This commit is contained in:
Juergen Hoeller 2021-12-15 21:52:16 +01:00
commit 9dc5c9f935
5 changed files with 16 additions and 16 deletions

View File

@ -84,7 +84,7 @@ configure(allprojects) { project ->
exclude group: "stax", name: "stax-api" exclude group: "stax", name: "stax-api"
} }
dependency "org.ogce:xpp3:1.1.6" dependency "org.ogce:xpp3:1.1.6"
dependency "org.yaml:snakeyaml:1.29" dependency "org.yaml:snakeyaml:1.30"
dependency "com.h2database:h2:1.4.200" dependency "com.h2database:h2:1.4.200"
dependency "com.github.ben-manes.caffeine:caffeine:3.0.5" dependency "com.github.ben-manes.caffeine:caffeine:3.0.5"
@ -183,7 +183,7 @@ configure(allprojects) { project ->
} }
entry 'mockito-junit-jupiter' entry 'mockito-junit-jupiter'
} }
dependency "io.mockk:mockk:1.12.0" dependency "io.mockk:mockk:1.12.1"
dependency("net.sourceforge.htmlunit:htmlunit:2.55.0") { dependency("net.sourceforge.htmlunit:htmlunit:2.55.0") {
exclude group: "commons-logging", name: "commons-logging" exclude group: "commons-logging", name: "commons-logging"

View File

@ -67,7 +67,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
@Override @Override
public void setImportMetadata(AnnotationMetadata importMetadata) { public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap( this.enableCaching = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false)); importMetadata.getAnnotationAttributes(EnableCaching.class.getName()));
if (this.enableCaching == null) { if (this.enableCaching == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"@EnableCaching is not present on importing class " + importMetadata.getClassName()); "@EnableCaching is not present on importing class " + importMetadata.getClassName());
@ -76,7 +76,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
@Autowired @Autowired
void setConfigurers(ObjectProvider<CachingConfigurer> configurers) { void setConfigurers(ObjectProvider<CachingConfigurer> configurers) {
Supplier<CachingConfigurer> cachingConfigurer = () -> { Supplier<CachingConfigurer> configurer = () -> {
List<CachingConfigurer> candidates = configurers.stream().collect(Collectors.toList()); List<CachingConfigurer> candidates = configurers.stream().collect(Collectors.toList());
if (CollectionUtils.isEmpty(candidates)) { if (CollectionUtils.isEmpty(candidates)) {
return null; return null;
@ -89,7 +89,7 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
} }
return candidates.get(0); return candidates.get(0);
}; };
useCachingConfigurer(new CachingConfigurerSupplier(cachingConfigurer)); useCachingConfigurer(new CachingConfigurerSupplier(configurer));
} }
/** /**

View File

@ -298,7 +298,7 @@ public abstract class AnnotationConfigUtils {
@Nullable @Nullable
static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, String annotationClassName) { static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, String annotationClassName) {
return AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(annotationClassName, false)); return AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(annotationClassName));
} }
static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata, static Set<AnnotationAttributes> attributesForRepeatable(AnnotationMetadata metadata,
@ -314,10 +314,10 @@ public abstract class AnnotationConfigUtils {
Set<AnnotationAttributes> result = new LinkedHashSet<>(); Set<AnnotationAttributes> result = new LinkedHashSet<>();
// Direct annotation present? // Direct annotation present?
addAttributesIfNotNull(result, metadata.getAnnotationAttributes(annotationClassName, false)); addAttributesIfNotNull(result, metadata.getAnnotationAttributes(annotationClassName));
// Container annotation present? // Container annotation present?
Map<String, Object> container = metadata.getAnnotationAttributes(containerClassName, false); Map<String, Object> container = metadata.getAnnotationAttributes(containerClassName);
if (container != null && container.containsKey("value")) { if (container != null && container.containsKey("value")) {
for (Map<String, Object> containedAttributes : (Map<String, Object>[]) container.get("value")) { for (Map<String, Object> containedAttributes : (Map<String, Object>[]) container.get("value")) {
addAttributesIfNotNull(result, containedAttributes); addAttributesIfNotNull(result, containedAttributes);

View File

@ -59,7 +59,7 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
@Override @Override
public void setImportMetadata(AnnotationMetadata importMetadata) { public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableAsync = AnnotationAttributes.fromMap( this.enableAsync = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableAsync.class.getName(), false)); importMetadata.getAnnotationAttributes(EnableAsync.class.getName()));
if (this.enableAsync == null) { if (this.enableAsync == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"@EnableAsync is not present on importing class " + importMetadata.getClassName()); "@EnableAsync is not present on importing class " + importMetadata.getClassName());
@ -71,7 +71,7 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
*/ */
@Autowired @Autowired
void setConfigurers(ObjectProvider<AsyncConfigurer> configurers) { void setConfigurers(ObjectProvider<AsyncConfigurer> configurers) {
Supplier<AsyncConfigurer> asyncConfigurer = SingletonSupplier.of(() -> { Supplier<AsyncConfigurer> configurer = SingletonSupplier.of(() -> {
List<AsyncConfigurer> candidates = configurers.stream().collect(Collectors.toList()); List<AsyncConfigurer> candidates = configurers.stream().collect(Collectors.toList());
if (CollectionUtils.isEmpty(candidates)) { if (CollectionUtils.isEmpty(candidates)) {
return null; return null;
@ -81,14 +81,14 @@ public abstract class AbstractAsyncConfiguration implements ImportAware {
} }
return candidates.get(0); return candidates.get(0);
}); });
this.executor = adapt(asyncConfigurer, AsyncConfigurer::getAsyncExecutor); this.executor = adapt(configurer, AsyncConfigurer::getAsyncExecutor);
this.exceptionHandler = adapt(asyncConfigurer, AsyncConfigurer::getAsyncUncaughtExceptionHandler); this.exceptionHandler = adapt(configurer, AsyncConfigurer::getAsyncUncaughtExceptionHandler);
} }
private <T> Supplier<T> adapt(Supplier<AsyncConfigurer> supplier, Function<AsyncConfigurer, T> provider) { private <T> Supplier<T> adapt(Supplier<AsyncConfigurer> supplier, Function<AsyncConfigurer, T> provider) {
return () -> { return () -> {
AsyncConfigurer asyncConfigurer = supplier.get(); AsyncConfigurer configurer = supplier.get();
return (asyncConfigurer != null) ? provider.apply(asyncConfigurer) : null; return (configurer != null ? provider.apply(configurer) : null);
}; };
} }

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2019 the original author or authors. * Copyright 2002-2021 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -57,7 +57,7 @@ public abstract class AbstractTransactionManagementConfiguration implements Impo
@Override @Override
public void setImportMetadata(AnnotationMetadata importMetadata) { public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableTx = AnnotationAttributes.fromMap( this.enableTx = AnnotationAttributes.fromMap(
importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName(), false)); importMetadata.getAnnotationAttributes(EnableTransactionManagement.class.getName()));
if (this.enableTx == null) { if (this.enableTx == null) {
throw new IllegalArgumentException( throw new IllegalArgumentException(
"@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName()); "@EnableTransactionManagement is not present on importing class " + importMetadata.getClassName());