-
Notifications
You must be signed in to change notification settings - Fork 26.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add empty constructor for DubboLifecycleComponentApplicationListener #7357
Add empty constructor for DubboLifecycleComponentApplicationListener #7357
Conversation
|
done |
@@ -43,6 +43,10 @@ | |||
|
|||
private final DubboBootstrap dubboBootstrap; | |||
|
|||
public DubboBootstrapApplicationListener() { | |||
this.dubboBootstrap = DubboBootstrap.getInstance(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If init by this constructor, the applicationContext in super class OnceApplicationContextEventListener
will null, when call getApplicationContext(), cause NPE, I'm not sure this case will be happen.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hi @horizonzy ,
I am not quite sure which class you mentioned which has getApplicationContext()
.
I have found there are two places use applicationContext
- OnceApplicationContextEventListener
ApplicationContextAware
has been implemented by OnceApplicationContextEventListener
, so applicationContext
will be automaticly injected by public final void setApplicationContext(ApplicationContext applicationContext) throws BeansException
- DubboBootstrapStartStopListenerSpringAdapter
The methods in DubboBootstrapStartStopListenerSpringAdapter
will be called after DubboBootstrap
started and before this ApplicationContextEvent
will notify DubboLifecycleComponentApplicationListener
with applicationContext
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
What is the purpose of the change
add empty constructor for DubboLifecycleComponentApplicationListener
related issue #7347