以下の構成を使用してコントローラーにメソッドがあります。
@RequestMapping(value = "/encore/{userName}/{token}", method = RequestMethod.GET)
@ResponseBody
@PreAuthorize("hasIpAddress('192.168.1.2/24')")
public EncoreAccount validateUserRequest(HttpServletRequest request,
@PathVariable(value = "userName") String userName,
@PathVariable(value = "token") String token) {
}
これはwebmvc-config.xmlにあります
<security:global-method-security pre-post-annotations="enabled" />
しかし、実行すると、以下の例外が発生します。
Caused by: org.springframework.expression.spel.SpelEvaluationException: EL1004E:(pos 0): Method call: Method hasIpAddress(java.lang.String) cannot be found on org.springframework.security.access.expression.method.MethodSecurityExpressionRoot type
hasIpAddress() が org.springframework.security.web.access.expression.WebSecurityExpressionRoot にあることはわかっています。
WebSecurityExpressionRoot でメソッドを検索しない理由を知っていますか?
どうもありがとう、