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

ResourceHttpRequestHandler no longer works as prototype bean [SPR-14851] #19417

Closed
spring-projects-issues opened this issue Oct 26, 2016 · 1 comment
Assignees
Milestone

Comments

@spring-projects-issues
Copy link
Collaborator

@spring-projects-issues spring-projects-issues commented Oct 26, 2016

Bernhard Frauendienst opened SPR-14851 and commented

After upgrading from 4.3.1 to 4.3.3, accessing a prototype bean ResourceHttpRequestHandler triggers a NullPointerException when the handler tries to access the pathExtensionStrategy that is created in afterSingletonsInstantiated.

This is caused by the fix for #19146.

Such a use-case breakage on a minor version upgrade is very inconvenient, even more so when it only is detected at runtime.

This is also somewhat unexpected behaviour. One might expect this method to be called on every bean that is created after the singleton instantiation phase. See #17512 for a related issue wrt lazy-init beans.


Affects: 4.3.3

Issue Links:

  • #19146 When favorPathExtension is false ResourceHttpRequestHandler serves resources with different content type in 4.3 compared to 4.2
  • #17512 SmartInitializingSingleton.afterSingletonsInstantiated() is not called for lazy beans

1 votes, 3 watchers

@spring-projects-issues
Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Oct 27, 2016

Juergen Hoeller commented

It seems unnecessary to initialize the content negotiation strategy in afterSingletonsInstantiated to begin with, since there is no access to other beans. The same conditional setup based on the presence of a ServletContext can be done in the regular afterPropertiesSet callback.

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