All Downloads are FREE. Search and download functionalities are using the official Maven repository.

spring.jsonhome-controller-beans.xml Maven / Gradle / Ivy

The newest version!
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:p="http://www.springframework.org/schema/p"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="
            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
            http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd
            http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd">

    <!--
     Activates annotation-based configuration so we can rely on annotations in the JsonHomeController.
     -->
    <context:annotation-config />

    <!--
     The JsonHomeController is using the application/json-home representation so we have to
     add a message converter for this.
    -->
    <mvc:annotation-driven>
        <mvc:message-converters register-defaults="true">
            <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
                <property name="supportedMediaTypes">
                    <list>
                        <value>application/json-home</value>
                    </list>
                </property>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>

    <!--
     Specify where to find the resources.
    -->
    <mvc:resources mapping="/jsonhome/**" location="classpath:/jsonhome/**" />

    <!--
     The controller used to serve the json-home documents. The dependencies are autowired.
    -->
    <bean class="de.otto.jsonhome.controller.JsonHomeController"
          p:maxAgeSeconds = "3600" />

    <!--
     The controller used to serve the HTML representation of the json-home document. The dependencies are autowired.
    -->
    <bean class="de.otto.jsonhome.controller.HtmlController" />

    <!--
     The JsonHomeGenerator to be used by the controllers. You may want to
     choose a different implementation (possibly your own one).
    -->
    <bean class="de.otto.jsonhome.generator.SpringJsonHomeGenerator" />

    <!--
     The JsonHomeSource used by the controllers to discover JsonHome objects.
     -->
    <bean class="de.otto.jsonhome.controller.GeneratorBasedJsonHomeSource" />

</beans>




© 2015 - 2025 Weber Informatics LLC | Privacy Policy