From 0a06bce3a6aae37c154e18615de9ef2ca25b3cd9 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Sun, 7 Jan 2018 23:23:25 +0100 Subject: [PATCH] Relaxed BeanFactory assertion in resolveInterceptorNames Issue: SPR-16347 --- .../framework/autoproxy/AbstractAutoProxyCreator.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java index 4773958990..fd097b2259 100644 --- a/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java +++ b/spring-aop/src/main/java/org/springframework/aop/framework/autoproxy/AbstractAutoProxyCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2017 the original author or authors. + * Copyright 2002-2018 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. @@ -544,13 +544,13 @@ public abstract class AbstractAutoProxyCreator extends ProxyProcessorSupport * @see #setInterceptorNames */ private Advisor[] resolveInterceptorNames() { - Assert.state(this.beanFactory != null, "BeanFactory required for resolving interceptor names"); - ConfigurableBeanFactory cbf = (this.beanFactory instanceof ConfigurableBeanFactory ? - (ConfigurableBeanFactory) this.beanFactory : null); + BeanFactory bf = this.beanFactory; + ConfigurableBeanFactory cbf = (bf instanceof ConfigurableBeanFactory ? (ConfigurableBeanFactory) bf : null); List advisors = new ArrayList<>(); for (String beanName : this.interceptorNames) { if (cbf == null || !cbf.isCurrentlyInCreation(beanName)) { - Object next = this.beanFactory.getBean(beanName); + Assert.state(bf != null, "BeanFactory required for resolving interceptor names"); + Object next = bf.getBean(beanName); advisors.add(this.advisorAdapterRegistry.wrap(next)); } }