Skip to content
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

Merged

Conversation

AlbumenJ
Copy link
Member

What is the purpose of the change

add empty constructor for DubboLifecycleComponentApplicationListener

related issue #7347

@kylixs
Copy link
Member

kylixs commented Mar 10, 2021

DubboBootstrapApplicationListener also need an empty constructor for compatible with old version

@AlbumenJ
Copy link
Member Author

DubboBootstrapApplicationListener also need an empty constructor for compatible with old version

done

@@ -43,6 +43,10 @@

private final DubboBootstrap dubboBootstrap;

public DubboBootstrapApplicationListener() {
this.dubboBootstrap = DubboBootstrap.getInstance();
Copy link
Member

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.

Copy link
Member Author

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.

Copy link
Member

@horizonzy horizonzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@AlbumenJ AlbumenJ merged commit eeac3a0 into apache:master Mar 28, 2021
AlbumenJ added a commit to AlbumenJ/dubbo that referenced this pull request May 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants