Clear nonAnnotatedClasses cache in afterSingletonsInstantiated
Issue: SPR-15175
(cherry picked from commit e566e25)
This commit is contained in:
parent
4f690eea2a
commit
155bbb8466
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -182,6 +182,9 @@ public class ScheduledAnnotationBeanPostProcessor
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterSingletonsInstantiated() {
|
public void afterSingletonsInstantiated() {
|
||||||
|
// Remove resolved singleton classes from cache
|
||||||
|
this.nonAnnotatedClasses.clear();
|
||||||
|
|
||||||
if (this.applicationContext == null) {
|
if (this.applicationContext == null) {
|
||||||
// Not running in an ApplicationContext -> register tasks early...
|
// Not running in an ApplicationContext -> register tasks early...
|
||||||
finishRegistration();
|
finishRegistration();
|
||||||
|
|
|
||||||
|
|
@ -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");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
|
@ -96,13 +96,13 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||||
|
|
||||||
private String containerFactoryBeanName = DEFAULT_JMS_LISTENER_CONTAINER_FACTORY_BEAN_NAME;
|
private String containerFactoryBeanName = DEFAULT_JMS_LISTENER_CONTAINER_FACTORY_BEAN_NAME;
|
||||||
|
|
||||||
|
private final MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory =
|
||||||
|
new MessageHandlerMethodFactoryAdapter();
|
||||||
|
|
||||||
private BeanFactory beanFactory;
|
private BeanFactory beanFactory;
|
||||||
|
|
||||||
private StringValueResolver embeddedValueResolver;
|
private StringValueResolver embeddedValueResolver;
|
||||||
|
|
||||||
private final MessageHandlerMethodFactoryAdapter messageHandlerMethodFactory =
|
|
||||||
new MessageHandlerMethodFactoryAdapter();
|
|
||||||
|
|
||||||
private final JmsListenerEndpointRegistrar registrar = new JmsListenerEndpointRegistrar();
|
private final JmsListenerEndpointRegistrar registrar = new JmsListenerEndpointRegistrar();
|
||||||
|
|
||||||
private final AtomicInteger counter = new AtomicInteger();
|
private final AtomicInteger counter = new AtomicInteger();
|
||||||
|
|
@ -155,14 +155,17 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||||
if (beanFactory instanceof ConfigurableBeanFactory) {
|
if (beanFactory instanceof ConfigurableBeanFactory) {
|
||||||
this.embeddedValueResolver = new EmbeddedValueResolver((ConfigurableBeanFactory) beanFactory);
|
this.embeddedValueResolver = new EmbeddedValueResolver((ConfigurableBeanFactory) beanFactory);
|
||||||
}
|
}
|
||||||
|
this.registrar.setBeanFactory(beanFactory);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void afterSingletonsInstantiated() {
|
public void afterSingletonsInstantiated() {
|
||||||
this.registrar.setBeanFactory(this.beanFactory);
|
// Remove resolved singleton classes from cache
|
||||||
|
this.nonAnnotatedClasses.clear();
|
||||||
|
|
||||||
if (this.beanFactory instanceof ListableBeanFactory) {
|
if (this.beanFactory instanceof ListableBeanFactory) {
|
||||||
|
// Apply JmsListenerConfigurer beans from the BeanFactory, if any
|
||||||
Map<String, JmsListenerConfigurer> instances =
|
Map<String, JmsListenerConfigurer> instances =
|
||||||
((ListableBeanFactory) this.beanFactory).getBeansOfType(JmsListenerConfigurer.class);
|
((ListableBeanFactory) this.beanFactory).getBeansOfType(JmsListenerConfigurer.class);
|
||||||
for (JmsListenerConfigurer configurer : instances.values()) {
|
for (JmsListenerConfigurer configurer : instances.values()) {
|
||||||
|
|
@ -171,6 +174,7 @@ public class JmsListenerAnnotationBeanPostProcessor
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.registrar.getEndpointRegistry() == null) {
|
if (this.registrar.getEndpointRegistry() == null) {
|
||||||
|
// Determine JmsListenerEndpointRegistry bean from the BeanFactory
|
||||||
if (this.endpointRegistry == null) {
|
if (this.endpointRegistry == null) {
|
||||||
Assert.state(this.beanFactory != null, "BeanFactory must be set to find endpoint registry by bean name");
|
Assert.state(this.beanFactory != null, "BeanFactory must be set to find endpoint registry by bean name");
|
||||||
this.endpointRegistry = this.beanFactory.getBean(
|
this.endpointRegistry = this.beanFactory.getBean(
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue