diff --git a/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java b/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java index e3d6c6fc888..f7d9d8a335b 100644 --- a/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java +++ b/spring-context/src/main/java/org/springframework/context/support/PostProcessorRegistrationDelegate.java @@ -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; } diff --git a/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java b/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java index 703a0006f84..9e034f6e240 100644 --- a/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java +++ b/spring-context/src/main/java/org/springframework/scheduling/annotation/AsyncAnnotationAdvisor.java @@ -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; } diff --git a/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java b/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java index f7030351c49..64d2378fc63 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java +++ b/spring-context/src/test/java/org/springframework/cache/config/CacheableService.java @@ -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 throwUncheckedSync(Object arg1); - // multi annotations T multiCache(Object arg1); T multiEvict(Object arg1); @@ -95,4 +94,5 @@ public interface CacheableService { T multiUpdate(Object arg1); TestEntity putRefersToResult(TestEntity arg1); + } diff --git a/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java b/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java index 3be247806f1..63b4a7cff0d 100644 --- a/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java +++ b/spring-context/src/test/java/org/springframework/cache/config/DefaultCacheableService.java @@ -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 { private final AtomicLong counter = new AtomicLong(); + private final AtomicLong nullInvocations = new AtomicLong(); + @Override @Cacheable("testCache") public Long cache(Object arg1) { 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 8f73c6ab9d2..75856f41676 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 @@ -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());