diff --git a/spring-context-support/spring-context-support.gradle b/spring-context-support/spring-context-support.gradle index 715b922b680..19e0b97fced 100644 --- a/spring-context-support/spring-context-support.gradle +++ b/spring-context-support/spring-context-support.gradle @@ -6,12 +6,12 @@ dependencies { api(project(":spring-core")) optional(project(":spring-jdbc")) // for Quartz support optional(project(":spring-tx")) // for Quartz support + optional("com.github.ben-manes.caffeine:caffeine") optional("jakarta.activation:jakarta.activation-api") optional("jakarta.mail:jakarta.mail-api") optional("javax.cache:cache-api") - optional("com.github.ben-manes.caffeine:caffeine") - optional("org.quartz-scheduler:quartz") optional("org.freemarker:freemarker") + optional("org.quartz-scheduler:quartz") testFixturesApi("org.junit.jupiter:junit-jupiter-api") testFixturesImplementation("org.assertj:assertj-core") testFixturesImplementation("org.mockito:mockito-core") @@ -20,10 +20,10 @@ dependencies { testImplementation(testFixtures(project(":spring-context"))) testImplementation(testFixtures(project(":spring-core"))) testImplementation(testFixtures(project(":spring-tx"))) - testImplementation("org.hsqldb:hsqldb") testImplementation("jakarta.annotation:jakarta.annotation-api") - testRuntimeOnly("org.ehcache:jcache") + testImplementation("org.hsqldb:hsqldb") + testRuntimeOnly("com.sun.mail:jakarta.mail") testRuntimeOnly("org.ehcache:ehcache") + testRuntimeOnly("org.ehcache:jcache") testRuntimeOnly("org.glassfish:jakarta.el") - testRuntimeOnly("com.sun.mail:jakarta.mail") } diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/CacheConfig.java b/spring-context/src/main/java/org/springframework/cache/annotation/CacheConfig.java index 234f353b142..78da3a22e5a 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/CacheConfig.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/CacheConfig.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2023 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. @@ -32,6 +32,7 @@ import java.lang.annotation.Target; * @author Stephane Nicoll * @author Sam Brannen * @since 4.1 + * @see Cacheable */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.RUNTIME) @@ -42,8 +43,10 @@ public @interface CacheConfig { * Names of the default caches to consider for caching operations defined * in the annotated class. *
If none is set at the operation level, these are used instead of the default. - *
May be used to determine the target cache (or caches), matching the - * qualifier value or the bean names of a specific bean definition. + *
Names may be used to determine the target cache(s), to be resolved via the + * configured {@link #cacheResolver()} which typically delegates to + * {@link org.springframework.cache.CacheManager#getCache}. + * For further details see {@link Cacheable#cacheNames()}. */ String[] cacheNames() default {}; diff --git a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java index a207d1f0609..e99218f465a 100644 --- a/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java +++ b/spring-context/src/main/java/org/springframework/cache/annotation/Cacheable.java @@ -70,8 +70,12 @@ public @interface Cacheable { /** * Names of the caches in which method invocation results are stored. - *
Names may be used to determine the target cache (or caches), matching - * the qualifier value or bean name of a specific bean definition. + *
Names may be used to determine the target cache(s), to be resolved via the + * configured {@link #cacheResolver()} which typically delegates to + * {@link org.springframework.cache.CacheManager#getCache}. + *
This will usually be a single cache name. If multiple names are specified, + * they will be consulted for a cache hit in the order of definition, and they + * will all receive a put/evict request for the same newly cached value. * @since 4.2 * @see #value * @see CacheConfig#cacheNames diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java index 8859f2202a3..a03381c5981 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/core/JdbcTemplate.java @@ -60,7 +60,7 @@ import org.springframework.util.LinkedCaseInsensitiveMap; import org.springframework.util.StringUtils; /** - * This is the central class in the JDBC core package. + * This is the central delegate in the JDBC core package. * It simplifies the use of JDBC and helps to avoid common errors. * It executes core JDBC workflow, leaving application code to provide SQL * and extract results. This class executes SQL queries or updates, initiating diff --git a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java index b2d18673830..122ceeba185 100644 --- a/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java +++ b/spring-jdbc/src/main/java/org/springframework/jdbc/datasource/TransactionAwareDataSourceProxy.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 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. @@ -186,7 +186,7 @@ public class TransactionAwareDataSourceProxy extends DelegatingDataSource { // Allow for differentiating between the proxy and the raw Connection. StringBuilder sb = new StringBuilder("Transaction-aware proxy for target Connection "); if (this.target != null) { - sb.append('[').append(this.target.toString()).append(']'); + sb.append('[').append(this.target).append(']'); } else { sb.append(" from DataSource [").append(this.targetDataSource).append(']');