What is the default resolution of Spring 3?

I read Spring 3 view permissions docs ... But in my project, I didn't define any. I simply return the ModelAndView or @ResponseBody from the controller methods. I think there is already a default view resolver already installed (maybe UrlBasedViewResolver ). What is it? Where can I get information in the docs about this?

If I want to add other views, such as JsonView or XmlView (now I use Jsp, which displays the data, but I read that I can avoid this by passing the model objects directly to special views that will do this for me) how can I handle with this default solution?

+7
source share
1 answer

By default, an automatically registered InternalResourceViewResolver ( UrlBasedViewResolver is an abstract superclass).

If you declare your own view transformer, then by default the InternalResourceViewResolver will not be used. You can, if you want, just rewrite it as an explicit bean. If there are several view permissions, they will be consulted until one of them returns the view object. However, because the servlet API is running, InternalResourceViewResolver should always be the last view converter in the chain.

If your controller method returns a View object directly, then there is no need to resolve the view, and the view will be displayed directly. Similarly, if you use @ResponseBody , the resolution of the view is excluded.

+10
source

All Articles