1 406错误

      <mvc:annotation-driven />不用动,请求的时候URL的文件扩展名应为json

      @ResponseBody会根据扩展名,或者Header,或者Parameter来判断要返回的具体格式

<mvc:annotation-driven content-negotiation-manager="contentNegotiationManager" />
    <bean id="contentNegotiationManager" class="org.springframework.web.accept.ContentNegotiationManagerFactoryBean">
        <property name="favorPathExtension" value="true" />
        <property name="favorParameter" value="false" />
        <property name="ignoreAcceptHeader" value="true" />
        <property name="mediaTypes">
            <props>
                <prop key="json">application/json</prop>
            </props>
        </property>
    </bean>

2 failed to lazily initialize a collection of role

加入OpenSessionInViewFilter过滤器

 

posted on 2014-01-23 11:18  网络大豆  阅读(385)  评论(0编辑  收藏  举报