Time for action – configuring ContentNegotiatingViewResolver
ContentNegotiatingViewResolver does not resolve views itself but delegates them to other view resolvers based on the request. Now, let's add the content negotiation capability to our application:
Open
pom.xml; you can findpom.xmlunder the project root directory itself.You will be able to see some tabs at the bottom of
pom.xmlfile. Select the Dependencies tab and click on the Add button of the Dependencies section.A Select Dependency window will appear; enter Group Id as
org.springframework, Artifact Id asspring-oxm, Version as4.0.3.RELEASE; select Scope as compile; and then click on the OK button.Similarly, add one more dependency Group Id as
org.codehaus.jackson, Artifact Id asjackson-mapper-asl, Version as1.9.10, and select Scope as compile. Then, click on the OK button and savepom.xml.Add the bean configuration for
ContentNegotiatingViewResolverin our web application's context configuration file,DispatcherServlet-context...