私はSpring MVCコントローラを持っており、Spring Method Securityで保護したいと考えています。それは動作しません。この例でSpring Security:@PreAuthorizeは@RequestMappingと一緒にしか動作しません。
@Controller
public class MyController {
@RequestMapping(value = "/test", method = {RequestMethod.POST, RequestMethod.GET})
@PreAuthorize("isAuthenticated()")
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
return test(request, response);
}
public ModelAndView test(HttpServletRequest request, HttpServletResponse response) throws Exception {
...
}
- @RequestMapping
と@PreAuthorize
注釈の異なる方法:
@Controller
public class MyController {
@RequestMapping(value = "/test", method = {RequestMethod.POST, RequestMethod.GET})
public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response) throws Exception {
return test(request, response);
}
@PreAuthorize("isAuthenticated()")
public ModelAndView test(HttpServletRequest request, HttpServletResponse response) throws Exception {
...
}
を@RequestMapping
と@PreAuthorize
注釈同じ方法 - 次の例でははそれが作品
この奇妙なbの理由は何かあなたは?
http://stackoverflow.com/a/19421786/1291150 –
ありがとう - このことができます! – olivmir