Polishing

This commit is contained in:
Juergen Hoeller 2025-08-22 22:00:52 +02:00
parent 300ae841ce
commit 55181fa1c9
3 changed files with 11 additions and 8 deletions

View File

@ -520,8 +520,7 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
* to check whether the bean with the given name matches the specified type. Allow
* additional constraints to be applied to ensure that beans are not created early.
* @param name the name of the bean to query
* @param typeToMatch the type to match against (as a
* {@code ResolvableType})
* @param typeToMatch the type to match against (as a {@code ResolvableType})
* @return {@code true} if the bean type matches, {@code false} if it
* doesn't match or cannot be determined yet
* @throws NoSuchBeanDefinitionException if there is no bean with the given name

View File

@ -60,12 +60,6 @@ class CacheOperationExpressionEvaluatorTests {
private final AnnotationCacheOperationSource source = new AnnotationCacheOperationSource();
private Collection<CacheOperation> getOps(String name) {
Method method = ReflectionUtils.findMethod(AnnotatedClass.class, name, Object.class, Object.class);
return this.source.getCacheOperations(method, AnnotatedClass.class);
}
@Test
void testMultipleCachingSource() {
Collection<CacheOperation> ops = getOps("multipleCaching");
@ -144,6 +138,12 @@ class CacheOperationExpressionEvaluatorTests {
assertThat(value).isEqualTo(String.class.getName());
}
private Collection<CacheOperation> getOps(String name) {
Method method = ReflectionUtils.findMethod(AnnotatedClass.class, name, Object.class, Object.class);
return this.source.getCacheOperations(method, AnnotatedClass.class);
}
private EvaluationContext createEvaluationContext(Object result) {
return createEvaluationContext(result, null);
}

View File

@ -104,6 +104,7 @@ class CachePutEvaluationTests {
assertThat(this.cache.get(anotherValue + 100).get()).as("Wrong value for @CachePut key").isEqualTo(anotherValue);
}
@Configuration
@EnableCaching
static class Config implements CachingConfigurer {
@ -121,8 +122,10 @@ class CachePutEvaluationTests {
}
@CacheConfig("test")
public static class SimpleService {
private AtomicLong counter = new AtomicLong();
/**
@ -144,4 +147,5 @@ class CachePutEvaluationTests {
return this.counter.getAndIncrement();
}
}
}