0

我从带有响应正文的控制器返回 JSON 时遇到问题,我看到休眠对数据库进行查询,但是在将列表转换为 json 的那一刻,我遇到了 firebug 内部服务器错误 500;

我的 servlet.xml

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


<annotation-driven />
<mvc:annotation-driven />

<mvc:default-servlet-handler />
<mvc:resources mapping="/resources/**" location="/resources/" />


<context:annotation-config />
<context:component-scan base-package="pl.daniluk.spotted.controller" />
<beans:bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
    <beans:property name="viewClass">
        <beans:value>
            org.springframework.web.servlet.view.tiles2.TilesView
        </beans:value>
    </beans:property>
    <beans:property name="contentType" value="text/html; charset=UTF-8"></beans:property>


</beans:bean>

<beans:bean id="tilesConfigurer" class="org.springframework.web.servlet.view.tiles2.TilesConfigurer">
    <beans:property name="definitions">
        <beans:list>
            <beans:value>/WEB-INF/tiles.xml</beans:value>
        </beans:list>
    </beans:property>
</beans:bean>

和带有@ResponseBody 的控制器

@Controller
@RequestMapping("/place")
public class PlaceControler {

@Autowired
private PlaceService placeService;

@RequestMapping(value = "/list", method = RequestMethod.GET)
@ResponseBody
public List<Place> getAllPlaces() {

    return placeService.getAllPlaces();
}

}

我在哪里犯错的任何线索?

4

0 回答 0