Skip to content

Fix NPE when using management port and spring.application.name is set #1002

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

Merged

Conversation

spartusch
Copy link
Contributor

The previous code attempts to differentiate between the application and the management servers by comparing event.getApplicationContext().getId(). This ID does contain the value of the spring.application.name property though. This property defaults to "application" and thus the IDs default to "application" and "application:management". The previous code does look for these default values. But this means that ActuatorProvider isn't initialized properly when spring.application.name is not set to the default value but to the application's name.

This fix checks the server namespace instead.

Fixes #996

@bnasslahsen
Copy link
Collaborator

Thank you @spartusch for your contribution.

@bnasslahsen bnasslahsen merged commit 718c736 into springdoc:master Dec 29, 2020
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.

Minimal project with use-management-port set causes NPE on api-docs endpoint
2 participants