diff --git a/build.gradle b/build.gradle
index 6021fa574ddf..5144dbccf8cd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -3,8 +3,8 @@ plugins {
id 'io.spring.nohttp' version '0.0.10'
id "io.freefair.aspectj" version '6.2.0' apply false
id 'org.jetbrains.dokka' version '1.5.0' apply false
- id 'org.jetbrains.kotlin.jvm' version '1.5.31' apply false
- id "org.jetbrains.kotlin.plugin.serialization" version "1.5.31" apply false
+ id 'org.jetbrains.kotlin.jvm' version '1.5.32' apply false
+ id "org.jetbrains.kotlin.plugin.serialization" version "1.5.32" apply false
id 'org.asciidoctor.jvm.convert' version '3.3.2'
id 'org.asciidoctor.jvm.pdf' version '3.3.2'
id "org.unbroken-dome.xjc" version '2.0.0' apply false
@@ -27,19 +27,19 @@ configure(allprojects) { project ->
dependencyManagement {
imports {
- mavenBom "com.fasterxml.jackson:jackson-bom:2.12.5"
- mavenBom "io.netty:netty-bom:4.1.70.Final"
- mavenBom "io.projectreactor:reactor-bom:2020.0.13"
- mavenBom "io.r2dbc:r2dbc-bom:Arabba-SR10"
+ mavenBom "com.fasterxml.jackson:jackson-bom:2.12.6"
+ mavenBom "io.netty:netty-bom:4.1.72.Final"
+ mavenBom "io.projectreactor:reactor-bom:2020.0.14"
+ mavenBom "io.r2dbc:r2dbc-bom:Arabba-SR11"
mavenBom "io.rsocket:rsocket-bom:1.1.1"
mavenBom "org.eclipse.jetty:jetty-bom:9.4.44.v20210927"
- mavenBom "org.jetbrains.kotlin:kotlin-bom:1.5.31"
+ mavenBom "org.jetbrains.kotlin:kotlin-bom:1.5.32"
mavenBom "org.jetbrains.kotlinx:kotlinx-coroutines-bom:1.5.2"
mavenBom "org.jetbrains.kotlinx:kotlinx-serialization-bom:1.2.2"
- mavenBom "org.junit:junit-bom:5.8.1"
+ mavenBom "org.junit:junit-bom:5.8.2"
}
dependencies {
- dependencySet(group: 'org.apache.logging.log4j', version: '2.14.1') {
+ dependencySet(group: 'org.apache.logging.log4j', version: '2.16.0') {
entry 'log4j-api'
entry 'log4j-core'
entry 'log4j-jul'
@@ -67,23 +67,23 @@ configure(allprojects) { project ->
dependency "io.reactivex:rxjava:1.3.8"
dependency "io.reactivex:rxjava-reactive-streams:1.2.1"
dependency "io.reactivex.rxjava2:rxjava:2.2.21"
- dependency "io.reactivex.rxjava3:rxjava:3.1.1"
- dependency "io.smallrye.reactive:mutiny:1.1.1"
+ dependency "io.reactivex.rxjava3:rxjava:3.1.3"
+ dependency "io.smallrye.reactive:mutiny:1.2.0"
dependency "io.projectreactor.tools:blockhound:1.0.6.RELEASE"
dependency "com.caucho:hessian:4.0.63"
dependency "com.fasterxml:aalto-xml:1.3.0"
- dependency("com.fasterxml.woodstox:woodstox-core:6.2.6") {
+ dependency("com.fasterxml.woodstox:woodstox-core:6.2.7") {
exclude group: "stax", name: "stax-api"
}
- dependency "com.google.code.gson:gson:2.8.8"
- dependency "com.google.protobuf:protobuf-java-util:3.18.0"
+ dependency "com.google.code.gson:gson:2.8.9"
+ dependency "com.google.protobuf:protobuf-java-util:3.19.1"
dependency "com.googlecode.protobuf-java-format:protobuf-java-format:1.4"
dependency("com.thoughtworks.xstream:xstream:1.4.18") {
exclude group: "xpp3", name: "xpp3_min"
exclude group: "xmlpull", name: "xmlpull"
}
- dependency "org.apache.johnzon:johnzon-jsonb:1.2.14"
+ dependency "org.apache.johnzon:johnzon-jsonb:1.2.15"
dependency("org.codehaus.jettison:jettison:1.3.8") {
exclude group: "stax", name: "stax-api"
}
@@ -92,10 +92,10 @@ configure(allprojects) { project ->
entry 'jibx-run'
}
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.github.ben-manes.caffeine:caffeine:2.9.2"
+ dependency "com.github.ben-manes.caffeine:caffeine:2.9.3"
dependency "com.github.librepdf:openpdf:1.3.26"
dependency "com.rometools:rome:1.16.0"
dependency "commons-io:commons-io:2.5"
@@ -128,43 +128,43 @@ configure(allprojects) { project ->
dependency "org.webjars:webjars-locator-core:0.48"
dependency "org.webjars:underscorejs:1.8.3"
- dependencySet(group: 'org.apache.tomcat', version: '9.0.54') {
+ dependencySet(group: 'org.apache.tomcat', version: '9.0.56') {
entry 'tomcat-util'
entry('tomcat-websocket') {
- exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
exclude group: "org.apache.tomcat", name: "tomcat-servlet-api"
+ exclude group: "org.apache.tomcat", name: "tomcat-websocket-api"
}
}
- dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.54') {
+ dependencySet(group: 'org.apache.tomcat.embed', version: '9.0.56') {
entry 'tomcat-embed-core'
entry 'tomcat-embed-websocket'
}
- dependencySet(group: 'io.undertow', version: '2.2.12.Final') {
+ dependencySet(group: 'io.undertow', version: '2.2.14.Final') {
entry 'undertow-core'
- entry('undertow-websockets-jsr') {
- exclude group: "org.jboss.spec.javax.websocket", name: "jboss-websocket-api_1.1_spec"
- }
entry('undertow-servlet') {
exclude group: "org.jboss.spec.javax.servlet", name: "jboss-servlet-api_4.0_spec"
exclude group: "org.jboss.spec.javax.annotation", name: "jboss-annotations-api_1.3_spec"
}
+ entry('undertow-websockets-jsr') {
+ exclude group: "org.jboss.spec.javax.websocket", name: "jboss-websocket-api_1.1_spec"
+ }
}
- dependencySet(group: 'com.squareup.okhttp3', version: '3.14.9') {
- entry 'okhttp'
- entry 'mockwebserver'
- }
+ dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.10"
+ dependency 'org.apache.httpcomponents.client5:httpclient5:5.1.2'
+ dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.2'
dependency("org.apache.httpcomponents:httpclient:4.5.13") {
exclude group: "commons-logging", name: "commons-logging"
}
- dependency("org.apache.httpcomponents:httpasyncclient:4.1.4") {
+ dependency("org.apache.httpcomponents:httpasyncclient:4.1.5") {
exclude group: "commons-logging", name: "commons-logging"
}
- dependency 'org.apache.httpcomponents.client5:httpclient5:5.1'
- dependency 'org.apache.httpcomponents.core5:httpcore5-reactive:5.1.1'
- dependency "org.eclipse.jetty:jetty-reactive-httpclient:1.1.9"
+ dependencySet(group: 'com.squareup.okhttp3', version: '3.14.9') {
+ entry 'okhttp'
+ entry 'mockwebserver'
+ }
- dependency "org.jruby:jruby:9.2.19.0"
+ dependency "org.jruby:jruby:9.2.20.1"
dependency "org.python:jython-standalone:2.7.1"
dependency "org.mozilla:rhino:1.7.11"
@@ -198,18 +198,18 @@ configure(allprojects) { project ->
exclude group: "org.hamcrest", name: "hamcrest-core"
}
}
- dependencySet(group: 'org.mockito', version: '4.0.0') {
+ dependencySet(group: 'org.mockito', version: '4.1.0') {
entry('mockito-core') {
exclude group: "org.hamcrest", name: "hamcrest-core"
}
entry 'mockito-junit-jupiter'
}
- dependency "io.mockk:mockk:1.12.0"
+ dependency "io.mockk:mockk:1.12.1"
- dependency("net.sourceforge.htmlunit:htmlunit:2.54.0") {
+ dependency("net.sourceforge.htmlunit:htmlunit:2.55.0") {
exclude group: "commons-logging", name: "commons-logging"
}
- dependency("org.seleniumhq.selenium:htmlunit-driver:2.54.0") {
+ dependency("org.seleniumhq.selenium:htmlunit-driver:2.55.0") {
exclude group: "commons-logging", name: "commons-logging"
}
dependency("org.seleniumhq.selenium:selenium-java:3.141.59") {
@@ -237,7 +237,7 @@ configure(allprojects) { project ->
dependency "com.ibm.websphere:uow:6.0.2.17"
dependency "com.jamonapi:jamon:2.82"
- dependency "joda-time:joda-time:2.10.10"
+ dependency "joda-time:joda-time:2.10.13"
dependency "org.eclipse.persistence:org.eclipse.persistence.jpa:2.7.9"
dependency "org.javamoney:moneta:1.3"
@@ -340,7 +340,7 @@ configure([rootProject] + javaProjects) { project ->
}
checkstyle {
- toolVersion = "9.0"
+ toolVersion = "9.2"
configDirectory.set(rootProject.file("src/checkstyle"))
}
@@ -353,12 +353,12 @@ configure([rootProject] + javaProjects) { project ->
testImplementation("io.mockk:mockk")
testImplementation("org.assertj:assertj-core")
// Pull in the latest JUnit 5 Launcher API to ensure proper support in IDEs.
- testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine")
+ testRuntimeOnly("org.junit.platform:junit-platform-launcher")
testRuntimeOnly("org.junit.platform:junit-platform-suite-engine")
testRuntimeOnly("org.apache.logging.log4j:log4j-core")
- testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
testRuntimeOnly("org.apache.logging.log4j:log4j-jul")
+ testRuntimeOnly("org.apache.logging.log4j:log4j-slf4j-impl")
// JSR-305 only used for non-required meta-annotations
compileOnly("com.google.code.findbugs:jsr305")
testCompileOnly("com.google.code.findbugs:jsr305")
@@ -383,9 +383,9 @@ configure([rootProject] + javaProjects) { project ->
"https://hc.apache.org/httpcomponents-client-5.1.x/current/httpclient5/apidocs/",
"https://projectreactor.io/docs/test/release/api/",
"https://junit.org/junit4/javadoc/4.13.2/",
- // Disabling linking to JUnit 5.8.1, since the `package-list` file no longer exists due to
+ // Disabling linking to JUnit 5.8.2, since the `package-list` file no longer exists due to
// https://github.com/junit-team/junit5/commit/67ad4e545518b0ce2b0e7c96df31a669866d5003.
- // "https://junit.org/junit5/docs/5.8.1/api/",
+ // "https://junit.org/junit5/docs/5.8.2/api/",
"https://www.reactive-streams.org/reactive-streams-1.0.3-javadoc/",
"https://javadoc.io/static/io.rsocket/rsocket-core/1.1.1/",
"https://r2dbc.io/spec/0.8.5.RELEASE/api/"
diff --git a/gradle.properties b/gradle.properties
index b46dbd487055..63caba700222 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -1,4 +1,4 @@
-version=5.3.13-SNAPSHOT
+version=5.3.14
org.gradle.jvmargs=-Xmx1536M
org.gradle.caching=true
org.gradle.parallel=true
diff --git a/settings.gradle b/settings.gradle
index 811aa851d64e..0f97d1fcaa87 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -6,7 +6,7 @@ pluginManagement {
}
plugins {
- id "com.gradle.enterprise" version "3.6.1"
+ id "com.gradle.enterprise" version "3.7.2"
id "io.spring.ge.conventions" version "0.0.7"
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
index 3e8c838704c4..8692371d3a8c 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/DefaultAopProxyFactory.java
@@ -45,9 +45,10 @@
* @see AdvisedSupport#setProxyTargetClass
* @see AdvisedSupport#setInterfaces
*/
-@SuppressWarnings("serial")
public class DefaultAopProxyFactory implements AopProxyFactory, Serializable {
+ private static final long serialVersionUID = 7930414337282325166L;
+
@Override
public AopProxy createAopProxy(AdvisedSupport config) throws AopConfigException {
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
index 6c9efc49f0d7..5e1ed1603fa6 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/ProxyFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -421,11 +421,7 @@ private boolean isNamedBeanAnAdvisorOrAdvice(String beanName) {
* are unaffected by such changes.
*/
private synchronized void initializeAdvisorChain() throws AopConfigException, BeansException {
- if (this.advisorChainInitialized) {
- return;
- }
-
- if (!ObjectUtils.isEmpty(this.interceptorNames)) {
+ if (!this.advisorChainInitialized && !ObjectUtils.isEmpty(this.interceptorNames)) {
if (this.beanFactory == null) {
throw new IllegalStateException("No BeanFactory available anymore (probably due to serialization) " +
"- cannot resolve interceptor names " + Arrays.asList(this.interceptorNames));
@@ -464,9 +460,9 @@ private synchronized void initializeAdvisorChain() throws AopConfigException, Be
addAdvisorOnChainCreation(advice);
}
}
- }
- this.advisorChainInitialized = true;
+ this.advisorChainInitialized = true;
+ }
}
diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
index dd557215c563..a6b09c63cbbe 100644
--- a/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
+++ b/spring-aop/src/main/java/org/springframework/aop/framework/adapter/ThrowsAdviceAdapter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2012 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -25,8 +25,8 @@
import org.springframework.aop.ThrowsAdvice;
/**
- * Adapter to enable {@link org.springframework.aop.MethodBeforeAdvice}
- * to be used in the Spring AOP framework.
+ * Adapter to enable {@link org.springframework.aop.ThrowsAdvice} to be used
+ * in the Spring AOP framework.
*
* @author Rod Johnson
* @author Juergen Hoeller
diff --git a/spring-aop/src/test/resources/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml b/spring-aop/src/test/resources/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml
index 64f222cdd372..6acd17a85671 100644
--- a/spring-aop/src/test/resources/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml
+++ b/spring-aop/src/test/resources/org/springframework/aop/config/AopNamespaceHandlerEventTests-context.xml
@@ -16,9 +16,9 @@
-
For matching a generic type, consider {@link #getBeanProvider(ResolvableType)}. * @param requiredType type the bean must match; can be an interface or superclass * @return a corresponding provider handle * @since 5.1 @@ -223,13 +224,20 @@ public interface BeanFactory { /** * Return a provider for the specified bean, allowing for lazy on-demand retrieval - * of instances, including availability and uniqueness options. - * @param requiredType type the bean must match; can be a generic type declaration. - * Note that collection types are not supported here, in contrast to reflective + * of instances, including availability and uniqueness options. This variant allows + * for specifying a generic type to match, similar to reflective injection points + * with generic type declarations in method/constructor parameters. + *
Note that collections of beans are not supported here, in contrast to reflective * injection points. For programmatically retrieving a list of beans matching a * specific type, specify the actual bean type as an argument here and subsequently * use {@link ObjectProvider#orderedStream()} or its lazy streaming/iteration options. + *
Also, generics matching is strict here, as per the Java assignment rules.
+ * For lenient fallback matching with unchecked semantics (similar to the ´unchecked´
+ * Java compiler warning), consider calling {@link #getBeanProvider(Class)} with the
+ * raw type as a second step if no full generic match is
+ * {@link ObjectProvider#getIfAvailable() available} with this variant.
* @return a corresponding provider handle
+ * @param requiredType type the bean must match; can be a generic type declaration
* @since 5.1
* @see ObjectProvider#iterator()
* @see ObjectProvider#stream()
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
index 389f19c9e488..2642e72d7ae5 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/ListableBeanFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -353,9 +353,31 @@ NOTE: This interface is a special purpose interface, mainly for
* internal use within the framework. It is recommended to implement the plain
- * {@link BeanPostProcessor} interface as far as possible, or to derive from
- * {@link InstantiationAwareBeanPostProcessorAdapter} in order to be shielded
- * from extensions to this interface.
+ * {@link BeanPostProcessor} interface as far as possible.
*
* @author Juergen Hoeller
* @author Rod Johnson
diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
index 048612fbed73..b019ef5361f3 100644
--- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
+++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -730,14 +730,23 @@ public Map To be implemented by classes annotated with
* {@link org.springframework.cache.annotation.EnableCaching} that wish
* or need to specify explicitly how exception caches are resolved for
- * annotation-driven cache management. Consider extending {@link JCacheConfigurerSupport},
- * which provides a stub implementation of all interface methods.
+ * annotation-driven cache management.
*
* See {@link org.springframework.cache.annotation.EnableCaching} for
* general examples and context; see {@link #exceptionCacheResolver()} for
@@ -36,7 +35,6 @@
* @author Stephane Nicoll
* @since 4.1
* @see CachingConfigurer
- * @see JCacheConfigurerSupport
* @see org.springframework.cache.annotation.EnableCaching
*/
public interface JCacheConfigurer extends CachingConfigurer {
@@ -60,6 +58,8 @@ public interface JCacheConfigurer extends CachingConfigurer {
* See {@link org.springframework.cache.annotation.EnableCaching} for more complete examples.
*/
@Nullable
- CacheResolver exceptionCacheResolver();
+ default CacheResolver exceptionCacheResolver() {
+ return null;
+ }
}
diff --git a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java
index 3edf2a2c153a..8b20e4b14822 100644
--- a/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java
+++ b/spring-context-support/src/main/java/org/springframework/cache/jcache/interceptor/AbstractFallbackJCacheOperationSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -79,7 +79,7 @@ public JCacheOperation> getCacheOperation(Method method, @Nullable Class> ta
@Nullable
private JCacheOperation> computeCacheOperation(Method method, @Nullable Class> targetClass) {
- // Don't allow no-public methods as required.
+ // Don't allow non-public methods, as configured.
if (allowPublicMethodsOnly() && !Modifier.isPublic(method.getModifiers())) {
return null;
}
diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java
index e0b12f443f91..f6042bee9347 100644
--- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java
+++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/LocalDataSourceJobStore.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -39,6 +39,8 @@
* Subclass of Quartz's {@link JobStoreCMT} class that delegates to a Spring-managed
* {@link DataSource} instead of using a Quartz-managed JDBC connection pool.
* This JobStore will be used if SchedulerFactoryBean's "dataSource" property is set.
+ * You may also configure it explicitly, possibly as a custom subclass of this
+ * {@code LocalDataSourceJobStore} or as an equivalent {@code JobStoreCMT} variant.
*
* Supports both transactional and non-transactional DataSource access.
* With a non-XA DataSource and local Spring transactions, a single DataSource
@@ -58,6 +60,8 @@
* @since 1.1
* @see SchedulerFactoryBean#setDataSource
* @see SchedulerFactoryBean#setNonTransactionalDataSource
+ * @see SchedulerFactoryBean#getConfigTimeDataSource()
+ * @see SchedulerFactoryBean#getConfigTimeNonTransactionalDataSource()
* @see org.springframework.jdbc.datasource.DataSourceUtils#doGetConnection
* @see org.springframework.jdbc.datasource.DataSourceUtils#releaseConnection
*/
diff --git a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java
index e0982a2e5ff9..15185bba6c37 100644
--- a/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java
+++ b/spring-context-support/src/main/java/org/springframework/scheduling/quartz/SchedulerFactoryBean.java
@@ -310,9 +310,11 @@ public void setTaskExecutor(Executor taskExecutor) {
/**
* Set the default {@link DataSource} to be used by the Scheduler.
- * If set, this will override corresponding settings in Quartz properties.
* Note: If this is set, the Quartz settings should not define
* a job store "dataSource" to avoid meaningless double configuration.
+ * Also, do not define a "org.quartz.jobStore.class" property at all.
+ * (You may explicitly define Spring's {@link LocalDataSourceJobStore}
+ * but that's the default when using this method anyway.)
* A Spring-specific subclass of Quartz' JobStoreCMT will be used.
* It is therefore strongly recommended to perform all operations on
* the Scheduler within Spring-managed (or plain JTA) transactions.
diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java
index 188cc293c974..e73dd79a222d 100644
--- a/spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java
+++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/JCacheEhCacheAnnotationTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
@@ -104,7 +104,7 @@ public void testEvictAllEarlyWithTransaction() {
@Configuration
@EnableCaching
- static class EnableCachingConfig extends CachingConfigurerSupport {
+ static class EnableCachingConfig implements CachingConfigurer {
@Autowired
CachingProvider cachingProvider;
diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java
index 5c12aceac022..1dcc12540d1e 100644
--- a/spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java
+++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/config/JCacheJavaConfigTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -180,7 +180,7 @@ public CacheResolver exceptionCacheResolver() {
@Configuration
@EnableCaching
- public static class EmptyConfigSupportConfig extends JCacheConfigurerSupport {
+ public static class EmptyConfigSupportConfig implements JCacheConfigurer {
@Bean
public CacheManager cm() {
return new NoOpCacheManager();
@@ -190,7 +190,7 @@ public CacheManager cm() {
@Configuration
@EnableCaching
- static class FullCachingConfigSupport extends JCacheConfigurerSupport {
+ static class FullCachingConfigSupport implements JCacheConfigurer {
@Override
@Bean
@@ -220,7 +220,7 @@ public CacheResolver exceptionCacheResolver() {
@Configuration
@EnableCaching
- static class NoExceptionCacheResolverConfig extends JCacheConfigurerSupport {
+ static class NoExceptionCacheResolverConfig implements JCacheConfigurer {
@Override
@Bean
diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java
index 3b341a0c4df0..561c0af54d1b 100644
--- a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java
+++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheErrorHandlerTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
-import org.springframework.cache.jcache.config.JCacheConfigurerSupport;
+import org.springframework.cache.jcache.config.JCacheConfigurer;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
@@ -141,7 +141,7 @@ public void clearFail() {
@Configuration
@EnableCaching
- static class Config extends JCacheConfigurerSupport {
+ static class Config implements JCacheConfigurer {
@Bean
@Override
diff --git a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheKeyGeneratorTests.java b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheKeyGeneratorTests.java
index dd5497764b0c..35db912df971 100644
--- a/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheKeyGeneratorTests.java
+++ b/spring-context-support/src/test/java/org/springframework/cache/jcache/interceptor/JCacheKeyGeneratorTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -34,7 +34,7 @@
import org.springframework.cache.interceptor.KeyGenerator;
import org.springframework.cache.interceptor.SimpleKey;
import org.springframework.cache.interceptor.SimpleKeyGenerator;
-import org.springframework.cache.jcache.config.JCacheConfigurerSupport;
+import org.springframework.cache.jcache.config.JCacheConfigurer;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@@ -97,7 +97,7 @@ public void getFiltered() {
@Configuration
@EnableCaching
- static class Config extends JCacheConfigurerSupport {
+ static class Config implements JCacheConfigurer {
@Bean
@Override
@@ -151,7 +151,7 @@ private void expect(Object... params) {
@Override
public Object generate(Object target, Method method, Object... params) {
assertThat(Arrays.equals(expectedParams, params)).as("Unexpected parameters: expected: "
- + Arrays.toString(this.expectedParams) + " but got: " + Arrays.toString(params)).isTrue();
+ + Arrays.toString(this.expectedParams) + " but got: " + Arrays.toString(params)).isTrue();
return new SimpleKey(params);
}
}
diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java b/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java
index c49d8d20c6e0..d6473e28e67b 100644
--- a/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java
+++ b/spring-context/src/main/java/org/springframework/cache/annotation/AbstractCachingConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -16,9 +16,12 @@
package org.springframework.cache.annotation;
-import java.util.Collection;
+import java.util.List;
+import java.util.function.Function;
import java.util.function.Supplier;
+import java.util.stream.Collectors;
+import org.springframework.beans.factory.ObjectProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.CacheManager;
import org.springframework.cache.interceptor.CacheErrorHandler;
@@ -30,6 +33,7 @@
import org.springframework.core.type.AnnotationMetadata;
import org.springframework.lang.Nullable;
import org.springframework.util.CollectionUtils;
+import org.springframework.util.function.SingletonSupplier;
/**
* Abstract base {@code @Configuration} class providing common structure
@@ -63,36 +67,67 @@ public abstract class AbstractCachingConfiguration implements ImportAware {
@Override
public void setImportMetadata(AnnotationMetadata importMetadata) {
this.enableCaching = AnnotationAttributes.fromMap(
- importMetadata.getAnnotationAttributes(EnableCaching.class.getName(), false));
+ importMetadata.getAnnotationAttributes(EnableCaching.class.getName()));
if (this.enableCaching == null) {
throw new IllegalArgumentException(
"@EnableCaching is not present on importing class " + importMetadata.getClassName());
}
}
- @Autowired(required = false)
- void setConfigurers(Collection See @{@link EnableCaching} for general examples and context; see
* {@link #cacheManager()}, {@link #cacheResolver()} and {@link #keyGenerator()}
@@ -37,7 +36,6 @@
* @author Stephane Nicoll
* @since 3.1
* @see EnableCaching
- * @see CachingConfigurerSupport
*/
public interface CachingConfigurer {
@@ -64,7 +62,9 @@ public interface CachingConfigurer {
* See @{@link EnableCaching} for more complete examples.
*/
@Nullable
- CacheManager cacheManager();
+ default CacheManager cacheManager() {
+ return null;
+ }
/**
* Return the {@link CacheResolver} bean to use to resolve regular caches for
@@ -89,7 +89,9 @@ public interface CachingConfigurer {
* See {@link EnableCaching} for more complete examples.
*/
@Nullable
- CacheResolver cacheResolver();
+ default CacheResolver cacheResolver() {
+ return null;
+ }
/**
* Return the key generator bean to use for annotation-driven cache management.
@@ -110,7 +112,9 @@ public interface CachingConfigurer {
* See @{@link EnableCaching} for more complete examples.
*/
@Nullable
- KeyGenerator keyGenerator();
+ default KeyGenerator keyGenerator() {
+ return null;
+ }
/**
* Return the {@link CacheErrorHandler} to use to handle cache-related errors.
@@ -133,6 +137,8 @@ public interface CachingConfigurer {
* See @{@link EnableCaching} for more complete examples.
*/
@Nullable
- CacheErrorHandler errorHandler();
+ default CacheErrorHandler errorHandler() {
+ return null;
+ }
}
diff --git a/spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java b/spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java
index 8de528875fb2..d20993ae27a7 100644
--- a/spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java
+++ b/spring-context/src/main/java/org/springframework/cache/interceptor/AbstractFallbackCacheOperationSource.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -124,7 +124,7 @@ protected Object getCacheKey(Method method, @Nullable Class> targetClass) {
@Nullable
private Collection If the annotation's value doesn't indicate a bean name, an appropriate
* name will be built based on the short name of the class (with the first
- * letter lower-cased). For example:
+ * letter lower-cased), unless the two first letters are uppercase. For example:
*
* Consider using {@link AsyncConfigurerSupport} providing default implementations for
- * both methods if only one element needs to be customized. Furthermore, backward compatibility
- * of this interface will be insured in case new customization options are introduced
- * in the future.
- *
* See @{@link EnableAsync} for usage examples.
*
* @author Chris Beams
@@ -40,7 +35,6 @@
* @since 3.1
* @see AbstractAsyncConfiguration
* @see EnableAsync
- * @see AsyncConfigurerSupport
*/
public interface AsyncConfigurer {
diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolExecutorFactoryBean.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolExecutorFactoryBean.java
index e880489f80af..3a853297b397 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolExecutorFactoryBean.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolExecutorFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -26,9 +26,7 @@
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
-import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
-import org.springframework.beans.factory.InitializingBean;
import org.springframework.lang.Nullable;
/**
@@ -65,7 +63,7 @@
*/
@SuppressWarnings("serial")
public class ThreadPoolExecutorFactoryBean extends ExecutorConfigurationSupport
- implements FactoryBean Default is "false".
+ * @since 5.3.14
+ * @see java.util.concurrent.ThreadPoolExecutor#prestartAllCoreThreads
+ */
+ public void setPrestartAllCoreThreads(boolean prestartAllCoreThreads) {
+ this.prestartAllCoreThreads = prestartAllCoreThreads;
+ }
+
/**
* Set the capacity for the ThreadPoolExecutor's BlockingQueue.
* Default is {@code Integer.MAX_VALUE}.
@@ -153,6 +163,9 @@ protected ExecutorService initializeExecutor(
if (this.allowCoreThreadTimeOut) {
executor.allowCoreThreadTimeOut(true);
}
+ if (this.prestartAllCoreThreads) {
+ executor.prestartAllCoreThreads();
+ }
// Wrap executor with an unconfigurable decorator.
this.exposedExecutor = (this.exposeUnconfigurableExecutor ?
diff --git a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
index 486e0c7cddb6..928814524c67 100644
--- a/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
+++ b/spring-context/src/main/java/org/springframework/scheduling/concurrent/ThreadPoolTaskExecutor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -94,6 +94,8 @@ public class ThreadPoolTaskExecutor extends ExecutorConfigurationSupport
private boolean allowCoreThreadTimeOut = false;
+ private boolean prestartAllCoreThreads = false;
+
@Nullable
private TaskDecorator taskDecorator;
@@ -197,6 +199,16 @@ public void setAllowCoreThreadTimeOut(boolean allowCoreThreadTimeOut) {
this.allowCoreThreadTimeOut = allowCoreThreadTimeOut;
}
+ /**
+ * Specify whether to start all core threads, causing them to idly wait for work.
+ * Default is "false".
+ * @since 5.3.14
+ * @see java.util.concurrent.ThreadPoolExecutor#prestartAllCoreThreads
+ */
+ public void setPrestartAllCoreThreads(boolean prestartAllCoreThreads) {
+ this.prestartAllCoreThreads = prestartAllCoreThreads;
+ }
+
/**
* Specify a custom {@link TaskDecorator} to be applied to any {@link Runnable}
* about to be executed.
@@ -256,6 +268,9 @@ public void execute(Runnable command) {
if (this.allowCoreThreadTimeOut) {
executor.allowCoreThreadTimeOut(true);
}
+ if (this.prestartAllCoreThreads) {
+ executor.prestartAllCoreThreads();
+ }
this.threadPoolExecutor = executor;
return executor;
diff --git a/spring-context/src/main/java/org/springframework/validation/DataBinder.java b/spring-context/src/main/java/org/springframework/validation/DataBinder.java
index 1818b94b48f2..612dfc5622a2 100644
--- a/spring-context/src/main/java/org/springframework/validation/DataBinder.java
+++ b/spring-context/src/main/java/org/springframework/validation/DataBinder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -418,11 +418,13 @@ public boolean isIgnoreInvalidFields() {
}
/**
- * Register fields that should be allowed for binding. Default is all
- * fields. Restrict this for example to avoid unwanted modifications
- * by malicious users when binding HTTP request parameters.
- * Supports "xxx*", "*xxx" and "*xxx*" patterns. More sophisticated matching
- * can be implemented by overriding the {@code isAllowed} method.
+ * Register fields that should be allowed for binding. Default is all fields.
+ * Restrict this for example to avoid unwanted modifications by malicious
+ * users when binding HTTP request parameters.
+ * Supports "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an
+ * arbitrary number of pattern parts), as well as direct equality. More
+ * sophisticated matching can be implemented by overriding the
+ * {@code isAllowed} method.
* Alternatively, specify a list of disallowed fields.
* @param allowedFields array of field names
* @see #setDisallowedFields
@@ -442,11 +444,13 @@ public String[] getAllowedFields() {
}
/**
- * Register fields that should not be allowed for binding. Default is none.
- * Mark fields as disallowed for example to avoid unwanted modifications
- * by malicious users when binding HTTP request parameters.
- * Supports "xxx*", "*xxx" and "*xxx*" patterns. More sophisticated matching
- * can be implemented by overriding the {@code isAllowed} method.
+ * Register fields that should not be allowed for binding. Default
+ * is none. Mark fields as disallowed for example to avoid unwanted
+ * modifications by malicious users when binding HTTP request parameters.
+ * Supports "xxx*", "*xxx", "*xxx*" and "xxx*yyy" matches (with an
+ * arbitrary number of pattern parts), as well as direct equality.
+ * More sophisticated matching can be implemented by overriding the
+ * {@code isAllowed} method.
* Alternatively, specify a list of allowed fields.
* @param disallowedFields array of field names
* @see #setAllowedFields
@@ -772,10 +776,11 @@ protected void checkAllowedFields(MutablePropertyValues mpvs) {
/**
* Return if the given field is allowed for binding.
* Invoked for each passed-in property value.
- * The default implementation checks for "xxx*", "*xxx" and "*xxx*" matches,
- * as well as direct equality, in the specified lists of allowed fields and
- * disallowed fields. A field matching a disallowed pattern will not be accepted
- * even if it also happens to match a pattern in the allowed list.
+ * The default implementation checks for "xxx*", "*xxx", "*xxx*" and "xxx*yyy"
+ * matches (with an arbitrary number of pattern parts), as well as direct equality,
+ * in the specified lists of allowed fields and disallowed fields. A field matching
+ * a disallowed pattern will not be accepted even if it also happens to match a
+ * pattern in the allowed list.
* Can be overridden in subclasses.
* @param field the field to check
* @return if the field is allowed
diff --git a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
index 57df369b68eb..91d85d35dadd 100644
--- a/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
+++ b/spring-context/src/test/java/org/springframework/aop/framework/ProxyFactoryBeanTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -65,10 +65,10 @@
import static org.assertj.core.api.Assertions.assertThatIOException;
/**
- * @since 13.03.2003
* @author Rod Johnson
* @author Juergen Hoeller
* @author Chris Beams
+ * @since 13.03.2003
*/
public class ProxyFactoryBeanTests {
@@ -633,20 +633,50 @@ public void testFrozenFactoryBean() {
DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
new XmlBeanDefinitionReader(bf).loadBeanDefinitions(new ClassPathResource(FROZEN_CONTEXT, CLASS));
- Advised advised = (Advised)bf.getBean("frozen");
+ Advised advised = (Advised) bf.getBean("frozen");
assertThat(advised.isFrozen()).as("The proxy should be frozen").isTrue();
}
@Test
- public void testDetectsInterfaces() throws Exception {
+ public void testDetectsInterfaces() {
ProxyFactoryBean fb = new ProxyFactoryBean();
fb.setTarget(new TestBean());
fb.addAdvice(new DebugInterceptor());
fb.setBeanFactory(new DefaultListableBeanFactory());
+
ITestBean proxy = (ITestBean) fb.getObject();
assertThat(AopUtils.isJdkDynamicProxy(proxy)).isTrue();
}
+ @Test
+ public void testWithInterceptorNames() {
+ DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+ bf.registerSingleton("debug", new DebugInterceptor());
+
+ ProxyFactoryBean fb = new ProxyFactoryBean();
+ fb.setTarget(new TestBean());
+ fb.setInterceptorNames("debug");
+ fb.setBeanFactory(bf);
+
+ Advised proxy = (Advised) fb.getObject();
+ assertThat(proxy.getAdvisorCount()).isEqualTo(1);
+ }
+
+ @Test
+ public void testWithLateInterceptorNames() {
+ DefaultListableBeanFactory bf = new DefaultListableBeanFactory();
+ bf.registerSingleton("debug", new DebugInterceptor());
+
+ ProxyFactoryBean fb = new ProxyFactoryBean();
+ fb.setTarget(new TestBean());
+ fb.setBeanFactory(bf);
+ fb.getObject();
+
+ fb.setInterceptorNames("debug");
+ Advised proxy = (Advised) fb.getObject();
+ assertThat(proxy.getAdvisorCount()).isEqualTo(1);
+ }
+
/**
* Fires only on void methods. Saves list of methods intercepted.
diff --git a/spring-context/src/test/java/org/springframework/cache/CacheReproTests.java b/spring-context/src/test/java/org/springframework/cache/CacheReproTests.java
index 4c81623f507e..b08c6f895a06 100644
--- a/spring-context/src/test/java/org/springframework/cache/CacheReproTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/CacheReproTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2020 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCache;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
@@ -306,7 +306,7 @@ public Object getNeverCache(String key) {
@Configuration
@EnableCaching
- public static class Spr13081Config extends CachingConfigurerSupport {
+ public static class Spr13081Config implements CachingConfigurer {
@Bean
@Override
diff --git a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java
index 858d9c0d5b92..6a7e1127aecd 100644
--- a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingIntegrationTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -83,6 +83,19 @@ private void fooGetSimple(FooService service) {
assertCacheHit(key, value, cache);
}
+ @Test
+ public void barServiceWithCacheableInterfaceCglib() {
+ this.context = new AnnotationConfigApplicationContext(BarConfigCglib.class);
+ BarService service = this.context.getBean(BarService.class);
+ Cache cache = getCache();
+
+ Object key = new Object();
+ assertCacheMiss(key, cache);
+
+ Object value = service.getSimple(key);
+ assertCacheHit(key, value, cache);
+ }
+
@Test
public void beanConditionOff() {
this.context = new AnnotationConfigApplicationContext(BeanConditionConfig.class);
@@ -124,7 +137,7 @@ private Cache getCache() {
@Configuration
- static class SharedConfig extends CachingConfigurerSupport {
+ static class SharedConfig implements CachingConfigurer {
@Override
@Bean
@@ -185,6 +198,36 @@ public Object getWithCondition(Object key) {
}
+ @Configuration
+ @Import(SharedConfig.class)
+ @EnableCaching(proxyTargetClass = true)
+ static class BarConfigCglib {
+
+ @Bean
+ public BarService barService() {
+ return new BarServiceImpl();
+ }
+ }
+
+
+ interface BarService {
+
+ @Cacheable(cacheNames = "testCache")
+ Object getSimple(Object key);
+ }
+
+
+ static class BarServiceImpl implements BarService {
+
+ private final AtomicLong counter = new AtomicLong();
+
+ @Override
+ public Object getSimple(Object key) {
+ return this.counter.getAndIncrement();
+ }
+ }
+
+
@Configuration
@Import(FooConfig.class)
@EnableCaching
diff --git a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
index ea7717478968..b7cb5f1755a8 100644
--- a/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/config/EnableCachingTests.java
@@ -18,11 +18,10 @@
import org.junit.jupiter.api.Test;
-import org.springframework.beans.factory.BeanCreationException;
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
import org.springframework.beans.factory.NoUniqueBeanDefinitionException;
import org.springframework.cache.CacheManager;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.interceptor.CacheErrorHandler;
import org.springframework.cache.interceptor.CacheInterceptor;
@@ -107,11 +106,8 @@ public void multipleCachingConfigurers() {
try {
ctx.refresh();
}
- catch (BeanCreationException ex) {
- Throwable root = ex.getRootCause();
- boolean condition = root instanceof IllegalStateException;
- assertThat(condition).isTrue();
- assertThat(root.getMessage().contains("implementations of CachingConfigurer")).isTrue();
+ catch (IllegalStateException ex) {
+ assertThat(ex.getMessage().contains("implementations of CachingConfigurer")).isTrue();
}
}
@@ -150,7 +146,7 @@ public void bothSetOnlyResolverIsUsed() {
@Configuration
@EnableCaching
- static class EnableCachingConfig extends CachingConfigurerSupport {
+ static class EnableCachingConfig implements CachingConfigurer {
@Override
@Bean
@@ -227,7 +223,7 @@ public CacheManager cm2() {
@Configuration
@EnableCaching
- static class MultiCacheManagerConfigurer extends CachingConfigurerSupport {
+ static class MultiCacheManagerConfigurer implements CachingConfigurer {
@Bean
public CacheManager cm1() {
@@ -253,7 +249,7 @@ public KeyGenerator keyGenerator() {
@Configuration
@EnableCaching
- static class EmptyConfigSupportConfig extends CachingConfigurerSupport {
+ static class EmptyConfigSupportConfig implements CachingConfigurer {
@Bean
public CacheManager cm() {
@@ -264,7 +260,7 @@ public CacheManager cm() {
@Configuration
@EnableCaching
- static class FullCachingConfig extends CachingConfigurerSupport {
+ static class FullCachingConfig implements CachingConfigurer {
@Override
@Bean
diff --git a/spring-context/src/test/java/org/springframework/cache/config/ExpressionCachingIntegrationTests.java b/spring-context/src/test/java/org/springframework/cache/config/ExpressionCachingIntegrationTests.java
index ae109aec5c56..5ba071381fc7 100644
--- a/spring-context/src/test/java/org/springframework/cache/config/ExpressionCachingIntegrationTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/config/ExpressionCachingIntegrationTests.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2016 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,7 +20,7 @@
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CachePut;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.ConfigurableApplicationContext;
@@ -122,7 +122,7 @@ public String getId() {
@Configuration
@EnableCaching
- static class SharedConfig extends CachingConfigurerSupport {
+ static class SharedConfig implements CachingConfigurer {
@Override
@Bean
diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
index cfcd9cd713ae..90e26dd51f39 100644
--- a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheErrorHandlerTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -28,7 +28,7 @@
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.support.SimpleCacheManager;
import org.springframework.cache.support.SimpleValueWrapper;
@@ -170,7 +170,7 @@ public void clearFailProperException() {
@Configuration
@EnableCaching
- static class Config extends CachingConfigurerSupport {
+ static class Config implements CachingConfigurer {
@Bean
@Override
diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java b/spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java
index d17630a8ed29..c257534c6fb0 100644
--- a/spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/interceptor/CachePutEvaluationTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
import org.springframework.context.ConfigurableApplicationContext;
@@ -106,7 +106,7 @@ public void getAndPut() {
@Configuration
@EnableCaching
- static class Config extends CachingConfigurerSupport {
+ static class Config implements CachingConfigurer {
@Bean
@Override
diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java
index ca2e76fc36ff..86f0223402f9 100644
--- a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheResolverCustomizationTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@
import org.springframework.cache.CacheManager;
import org.springframework.cache.annotation.CacheConfig;
import org.springframework.cache.annotation.Cacheable;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -149,7 +149,7 @@ public void unknownCacheResolver() {
@Configuration
@EnableCaching
- static class Config extends CachingConfigurerSupport {
+ static class Config implements CachingConfigurer {
@Override
@Bean
diff --git a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheSyncFailureTests.java b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheSyncFailureTests.java
index 2a3eccc6db7b..de4776adae2e 100644
--- a/spring-context/src/test/java/org/springframework/cache/interceptor/CacheSyncFailureTests.java
+++ b/spring-context/src/test/java/org/springframework/cache/interceptor/CacheSyncFailureTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.Caching;
-import org.springframework.cache.annotation.CachingConfigurerSupport;
+import org.springframework.cache.annotation.CachingConfigurer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
@@ -133,7 +133,7 @@ public Object syncWithTwoGetOperations(Object arg1) {
@Configuration
@EnableCaching
- static class Config extends CachingConfigurerSupport {
+ static class Config implements CachingConfigurer {
@Override
@Bean
diff --git a/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java
index 477a97dec3df..2599d1a3cefb 100644
--- a/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java
+++ b/spring-context/src/test/java/org/springframework/scheduling/annotation/AsyncAnnotationBeanPostProcessorTests.java
@@ -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");
* you may not use this file except in compliance with the License.
@@ -218,8 +218,8 @@ public void handleExceptionWithListenableFuture() {
private void assertFutureWithException(Futurecom.xyz.FooServiceImpl -> fooServiceImpl
+ * com.xyz.URLFooServiceImpl -> URLFooServiceImpl
*
* @author Juergen Hoeller
* @author Mark Fisher
diff --git a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
index 91b1719b7083..0c6e55670953 100644
--- a/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
+++ b/spring-context/src/main/java/org/springframework/context/annotation/AnnotationConfigUtils.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2002-2018 the original author or authors.
+ * Copyright 2002-2021 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -282,7 +282,7 @@ static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, Class<
@Nullable
static AnnotationAttributes attributesFor(AnnotatedTypeMetadata metadata, String annotationClassName) {
- return AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(annotationClassName, false));
+ return AnnotationAttributes.fromMap(metadata.getAnnotationAttributes(annotationClassName));
}
static Set