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

ResourceUrlProvider should initialize only once [SPR-12592] #17193

Closed
spring-issuemaster opened this issue Jan 2, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jan 2, 2015

Joris Kuipers opened SPR-12592 and commented

Currently, the ResourceUrlProvider auto-initializes itself on every ContextRefreshedEvent. This breaks down when the application has all beans configured in the root context and uses an empty web application context for its DispatcherServlet. The ContextRefreshedEvent of the latter is handled by the ResourceUrlProvider after it has already properly initialized itself, thereby causing it to empty its handlerMap.

I would suggest to set the autodetect flag to false in onApplicationEvent if the handlerMap is non-empty after calling detectResourceHandlers. Right now it's quite complicated to work around this issue.


Affects: 4.1.4

Issue Links:

  • #17248 ResourceUrlProvider does not keep resource handlers ordered

Referenced from: commits 2bf6b41, f902fb9

0 votes, 5 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jan 13, 2015

Rossen Stoyanchev commented

Good point. We should consider detecting ResourceHttpRequestHandler's in parent contexts as well. That way the second ContextRefreshedEvent won't come up empty, which leaves the possibility to autodetect with each context refresh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.