Introduce removeApplicationListener method at ApplicationContext level
Closes gh-14023
This commit is contained in:
parent
8627bef8d9
commit
f8c4071f73
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2020 the original author or authors.
|
* Copyright 2002-2022 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.
|
||||||
|
@ -169,6 +169,14 @@ public interface ConfigurableApplicationContext extends ApplicationContext, Life
|
||||||
*/
|
*/
|
||||||
void addApplicationListener(ApplicationListener<?> listener);
|
void addApplicationListener(ApplicationListener<?> listener);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Remove the given ApplicationListener from this context's set of listeners,
|
||||||
|
* assuming it got registered via {@link #addApplicationListener} before.
|
||||||
|
* @param listener the ApplicationListener to deregister
|
||||||
|
* @since 6.0
|
||||||
|
*/
|
||||||
|
void removeApplicationListener(ApplicationListener<?> listener);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify the ClassLoader to load class path resources and bean classes with.
|
* Specify the ClassLoader to load class path resources and bean classes with.
|
||||||
* <p>This context class loader will be passed to the internal bean factory.
|
* <p>This context class loader will be passed to the internal bean factory.
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2002-2021 the original author or authors.
|
* Copyright 2002-2022 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.
|
||||||
|
@ -534,6 +534,15 @@ public abstract class AbstractApplicationContext extends DefaultResourceLoader
|
||||||
this.applicationListeners.add(listener);
|
this.applicationListeners.add(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeApplicationListener(ApplicationListener<?> listener) {
|
||||||
|
Assert.notNull(listener, "ApplicationListener must not be null");
|
||||||
|
if (this.applicationEventMulticaster != null) {
|
||||||
|
this.applicationEventMulticaster.removeApplicationListener(listener);
|
||||||
|
}
|
||||||
|
this.applicationListeners.remove(listener);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the list of statically specified ApplicationListeners.
|
* Return the list of statically specified ApplicationListeners.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue