Skip to content

UrlBasedViewResolver should implement setExposedContextBeanNames (not InternalResourceViewResolver) [SPR-8064] #12719

@spring-projects-issues

Description

@spring-projects-issues

Scott Murphy opened SPR-8064 and commented

InternalResourceViewResolver has the ability to inject beans into a view. This is very useful if you have some beans that have static content you want to render in all of your views.

#9244 implemented setExposedContextBeanNames(String[] exposedContextBeanNames) on InternalResourceViewResolver.

This was good, but limits to only using an InternalResourceViewResolver.

If you are using a org.springframework.web.servlet.view.UrlBasedViewResolver with Tiles
you have to come up with your own solution like here
http://stackoverflow.com/questions/2848415/accessing-spring-beans-from-a-tiles-view-jsp.

Since InternalResourceViewResolver extends UrlBasedViewResolver, why not just have UrlBasedViewResolver implement setExposedContextBeanNames(String[] exposedContextBeanNames) AND setExposeContextBeansAsAttributes(boolean exposeContextBeansAsAttributes) ?

If possible, maybe even move the methods all the way to org.springframework.web.servlet.view.AbstractCachingViewResolver ?


Affects: 3.0.5, 3.0.6, 3.1 M1

Attachments:

Issue Links:

Referenced from: commits a05b748

5 votes, 4 watchers

Metadata

Metadata

Assignees

Labels

in: webIssues in web modules (web, webmvc, webflux, websocket)type: enhancementA general enhancement

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions