what different between InternalResourceViewResolver vs UrlBasedViewResolver

java, spring

Solution

`InternalResourceViewResolver` is a convenient subclass of `UrlBasedViewResolver`.

The JavaDoc describes some added properties in `InternalResourceViewResolver` that might be useful in some situations:

Convenient subclass of UrlBasedViewResolver that supports InternalResourceView (i.e. Servlets and JSPs) and subclasses such as JstlView.

`AlwaysInclude`: Controls whether either a forward or include is done.

`ExposeContextBeansAsAttributes`: Allows all beans in context to be available as request attributes, which means they can be referenced from the EL in JSP.

`ExposedContextBeanNames`: If non-null, specifies the list of beans that will be exposed, as opposed to all of them.

Source from spring forum : Spring Q&A forum

Problem

I just started using Spring. I came across a lot tutorials. I saw more examples using `InternalResourceViewResolver` than `UrlBasedViewResolver`. I looked at the Spring documentation, but I can't figure out the benefit of using one or the other. Can someone provide some explanation?

Original source