【发布时间】:2017-03-02 23:03:47
【问题描述】:
这是我的 java 控制器:
@Controller
@RequestMapping("/resetPassword")
@Service
public class GmiResetPasswordController {
@RequestMapping(value = "/resetPassword/{id}/{token}", method = RequestMethod.GET)
public
@ResponseBody
AnalystDetails getDetails(Model model, HttpServletRequest request, @PathVariable("id") int id, @PathVariable("token") String token) {
//getDetails
[...]
我正在尝试使用这个网址:http://localhost:8080/resetPassword/59/3e3ac731-3ac4-45eb-8bf6-5f8e4b00298c
这是我的 Spring Security xml:
<security:http pattern="/resetPassword/**" security="none">
</security:http>
有什么帮助吗??
编辑 将控制器更改为:
@Controller
@RequestMapping("/resetPassword")
public class GmiResetPasswordController {
@RequestMapping(value = "/{id}/{token}", method = RequestMethod.GET)
public
@ResponseBody
AnalystDetails getDetails(Model model, HttpServletRequest request, @PathVariable(value = "id") int id, @PathVariable(value = "token") String token) {
[...]
}
还是不行..这是链接:http://localhost:8080/resetPassword/59/52ed96c3-5041-4ff9-be66-0aa2dbeca713
【问题讨论】:
-
为什么你的控制器被@Service注解了?删除服务注释。您正在控制器级别和方法级别映射到 resetPassword,因此您要映射的 url 是 /resetPassword/resetPassword/{id}/{token} 删除其中之一。