我正在开发一个 Web 项目并使用 Spring MVC 3.1.1。 Spring MVC用于提供REST服务(使用URL注释)
关于我的问题:
假设我的服务 URL 路径为;
http://localhost:8080/MyAppName/services/meteo/queryWeatherData/lon/39.1123/lat/39.3123
我的 Controller 方法是:
@RequestMapping(method = RequestMethod.GET, value = {"/queryWeatherData/lon/{lon}/lat/{lat}"})
public void queryWeatherData(
final @PathVariable("lon") float lon,
final @PathVariable("lat") float lat,
final HttpServletResponse response, final HttpServletRequest request) {
//
// DO STUFF and prepare response
//
}
我看到第二个参数(lat)在“.”之后被截断。所以我看到服务器端的值为 39.0。
我尝试在 app-context.xml 中声明 DefaultAnnotationHandlerMapping bean 并将其 useDefaultSuffixPattern 设置为 false,但它不起作用。
Làm thế nào để giải quyết vấn đề này?
Tôi là một lập trình viên xuất sắc, rất giỏi!