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

BeanNameViewResolver should not try to use non-View beans [SPR-12079] #16695

spring-projects-issues opened this issue Aug 12, 2014 · 1 comment
in: web type: enhancement


Copy link

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

Oliver Drotbohm opened SPR-12079 and commented

To resolve a view, BeanNameViewResolver checks for the presence of a bean with the view name and then looks it up using context.getBean(name, View.class).

This throws an exception if the view name is the name of an arbitrary Spring bean by accident, which is not a View. I suggest to look up the bean instance without the type constraint and only return it if it really implements View. Alternatively, the BeanNotOfRequiredTypeException could be caught and handled by returning null.

Affects: 3.2.10, 4.0.6, 4.1 RC1

Referenced from: commits 42c090e, 626a5fe, 035a9b9, 92bd240

Copy link
Collaborator Author

@spring-projects-issues spring-projects-issues commented Aug 13, 2014

Juergen Hoeller commented

I assume this is only really a problem in a chained view resolution scenario where another resolver is able to resolve that view name later on? The downside in a single resolver scenario is that we'd silently not return a view despite the convention having matched, with no indication that the reason was a type mismatch...


@spring-projects-issues spring-projects-issues added type: enhancement in: web labels Jan 11, 2019
@spring-projects-issues spring-projects-issues added this to the 4.0.7 milestone Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
in: web type: enhancement
None yet

No branches or pull requests

2 participants