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

LiveBeansView generates invalid JSON on specific case [SPR-11366] #15992

Closed
spring-projects-issues opened this issue Jan 28, 2014 · 4 comments
Closed

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Jan 28, 2014

Ilayaperumal Gopinathan opened SPR-11366 and commented

In org.springframework.context.support.LiveBeansView, the JSON snapshot of beans has a comma "," at the end of the last bean definition on a specific case when one of these met:

  1. If any of the bean definitions in the context's bean factory is of infrastructure bean
  2. If the bean is lazily initialized
  3. If the bean is not singleton

It looks like the logic to generate the JSON in "generateJson(Set<ConfigurableApplicationContext> contexts)" method adds comma "," to the bean definitions based on the beanNames length. But if any of the above conditions met this adds the comma to the last bean definition as well. This causes the JSON to be invalid.


Affects: 3.2 GA, 4.0 GA

Issue Links:

  • XD-1271 Investigate missing boot's actuator endpoints in XD

Backported to: 3.2.8

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 30, 2014

Juergen Hoeller commented

Good catch! I've taken the opportunity to refine LiveBeansView's implementation a bit, also extracting an overridable isBeanEligible template method.

Feel free to give this a try with the upcoming 4.0.2 snapshot...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Jan 30, 2014

Ilayaperumal Gopinathan commented

Sure, thanks very much for fixing it!

Ilaya

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 12, 2014

Juergen Hoeller commented

Have you had a chance to give it a try? We're about to release 4.0.2 and 3.2.8 towards the end of this week, so pre-release testing is very welcome...

Juergen

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Feb 12, 2014

Ilayaperumal Gopinathan commented

I just verified the fix from the latest 4.0.2 SNAPSHOT and it looks good.

Thanks again,
Ilaya

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants