Polishing
This commit is contained in:
parent
d003f6614b
commit
6d6cf01a42
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -322,7 +322,7 @@ class PostProcessorRegistrationDelegate {
|
|||
if (bean != null && !(bean instanceof BeanPostProcessor) && !isInfrastructureBean(beanName) &&
|
||||
this.beanFactory.getBeanPostProcessorCount() < this.beanPostProcessorTargetCount) {
|
||||
if (logger.isInfoEnabled()) {
|
||||
logger.info("Bean '" + beanName + "' of type [" + bean.getClass() +
|
||||
logger.info("Bean '" + beanName + "' of type [" + bean.getClass().getName() +
|
||||
"] is not eligible for getting processed by all BeanPostProcessors " +
|
||||
"(for example: not eligible for auto-proxying)");
|
||||
}
|
||||
|
@ -333,7 +333,7 @@ class PostProcessorRegistrationDelegate {
|
|||
private boolean isInfrastructureBean(String beanName) {
|
||||
if (beanName != null && this.beanFactory.containsBeanDefinition(beanName)) {
|
||||
BeanDefinition bd = this.beanFactory.getBeanDefinition(beanName);
|
||||
return RootBeanDefinition.ROLE_INFRASTRUCTURE == bd.getRole();
|
||||
return (bd.getRole() == RootBeanDefinition.ROLE_INFRASTRUCTURE);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -159,11 +159,12 @@ public class AsyncAnnotationAdvisor extends AbstractPointcutAdvisor implements B
|
|||
Pointcut cpc = new AnnotationMatchingPointcut(asyncAnnotationType, true);
|
||||
Pointcut mpc = AnnotationMatchingPointcut.forMethodAnnotation(asyncAnnotationType);
|
||||
if (result == null) {
|
||||
result = new ComposablePointcut(cpc).union(mpc);
|
||||
result = new ComposablePointcut(cpc);
|
||||
}
|
||||
else {
|
||||
result.union(cpc).union(mpc);
|
||||
result.union(cpc);
|
||||
}
|
||||
result = result.union(mpc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
* Copyright 2002-2017 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.
|
||||
|
@ -17,7 +17,7 @@
|
|||
package org.springframework.cache.config;
|
||||
|
||||
/**
|
||||
* Basic service interface.
|
||||
* Basic service interface for caching tests.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Phillip Webb
|
||||
|
@ -83,7 +83,6 @@ public interface CacheableService<T> {
|
|||
|
||||
T throwUncheckedSync(Object arg1);
|
||||
|
||||
// multi annotations
|
||||
T multiCache(Object arg1);
|
||||
|
||||
T multiEvict(Object arg1);
|
||||
|
@ -95,4 +94,5 @@ public interface CacheableService<T> {
|
|||
T multiUpdate(Object arg1);
|
||||
|
||||
TestEntity putRefersToResult(TestEntity arg1);
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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,7 +25,7 @@ import org.springframework.cache.annotation.Cacheable;
|
|||
import org.springframework.cache.annotation.Caching;
|
||||
|
||||
/**
|
||||
* Simple cacheable service
|
||||
* Simple cacheable service.
|
||||
*
|
||||
* @author Costin Leau
|
||||
* @author Phillip Webb
|
||||
|
@ -34,8 +34,10 @@ import org.springframework.cache.annotation.Caching;
|
|||
public class DefaultCacheableService implements CacheableService<Long> {
|
||||
|
||||
private final AtomicLong counter = new AtomicLong();
|
||||
|
||||
private final AtomicLong nullInvocations = new AtomicLong();
|
||||
|
||||
|
||||
@Override
|
||||
@Cacheable("testCache")
|
||||
public Long cache(Object arg1) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
* Copyright 2002-2017 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,8 +65,6 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
|||
assertSame(this.ctx.getBean("errorHandler", CacheErrorHandler.class), ci.getErrorHandler());
|
||||
}
|
||||
|
||||
// --- local tests -------
|
||||
|
||||
@Test
|
||||
public void singleCacheManagerBean() throws Throwable {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
|
@ -92,7 +90,7 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
|||
public void multipleCacheManagerBeans_implementsCachingConfigurer() {
|
||||
AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext();
|
||||
ctx.register(MultiCacheManagerConfigurer.class);
|
||||
ctx.refresh(); // does not throw
|
||||
ctx.refresh(); // does not throw an exception
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
|
@ -125,22 +123,17 @@ public class EnableCachingTests extends AbstractCacheAnnotationTests {
|
|||
|
||||
@Test
|
||||
public void emptyConfigSupport() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(EmptyConfigSupportConfig.class);
|
||||
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
|
||||
assertNotNull(ci.getCacheResolver());
|
||||
assertEquals(SimpleCacheResolver.class, ci.getCacheResolver().getClass());
|
||||
assertSame(context.getBean(CacheManager.class),
|
||||
((SimpleCacheResolver)ci.getCacheResolver()).getCacheManager());
|
||||
assertSame(context.getBean(CacheManager.class), ((SimpleCacheResolver)ci.getCacheResolver()).getCacheManager());
|
||||
context.close();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bothSetOnlyResolverIsUsed() {
|
||||
ConfigurableApplicationContext context =
|
||||
new AnnotationConfigApplicationContext(FullCachingConfig.class);
|
||||
|
||||
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(FullCachingConfig.class);
|
||||
CacheInterceptor ci = context.getBean(CacheInterceptor.class);
|
||||
assertSame(context.getBean("cacheResolver"), ci.getCacheResolver());
|
||||
assertSame(context.getBean("keyGenerator"), ci.getKeyGenerator());
|
||||
|
|
Loading…
Reference in New Issue