BeanNameViewResolver should not try to use non-View beans [SPR-12079] #16695
Labels
in: web
Issues in web modules (web, webmvc, webflux, websocket)
type: enhancement
A general enhancement
Milestone
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 usingcontext.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 implementsView
. Alternatively, theBeanNotOfRequiredTypeException
could be caught and handled by returningnull
.Affects: 3.2.10, 4.0.6, 4.1 RC1
Referenced from: commits 42c090e, 626a5fe, 035a9b9, 92bd240
The text was updated successfully, but these errors were encountered: