What is the best way to have every request be sent to a single ViewResolver – specifically in this case a JsonView?
Was thinking this:
<bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
<property name="viewClass" value="org.springframework.web.servlet.view.json.MappingJacksonJsonView" />
<property name="prefix" value="*" />
</bean>
but, is there something better/easier?
You’ve misunderstood what a
ViewResolveris for. They’re not there to service requests (that’s what controllers are for), they’re there to turn view names (as returned by the controller) into views (e.g. JSPs). Theprefixandsuffixproperties are used to assemble the path to the view.If you could describe what problem you’re trying to solve, we can show you how.