Spring Security MethodSecurityEvaluationContext lookupVariable和addArgumentsAsVariables方法的问题

时间:2014-03-19 08:09:05

标签: spring-security aop

我遇到MethodSecurityEvaluationContext lookupVariableaddArgumentsAsVariables方法的问题,如下所示:

paramNames本地变量本身不为空,但始终包含空条目

有谁知道可能导致这种情况的原因?

screen capture

以下是使用@PreAuthorize注释的方法(在Roo生成的itd中):

@PreAuthorize("isAuthenticated() AND hasPermission(#id, 'CurriculumService:findCurriculumIsAllowed')")
public Curriculum CurriculumServiceImpl.findCurriculum(Long id) {
    return curriculumRepository.findOne(id);
}

1 个答案:

答案 0 :(得分:0)

我得到了上述问题的答案。必须使用@P("id")注释参数,如下所示:

@PreAuthorize("isAuthenticated() AND hasPermission(#id, 'CurriculumService:findCurriculumIsAllowed')")
public Curriculum CurriculumServiceImpl.findCurriculum(@P("id") Long id) {
    return curriculumRepository.findOne(id);
}

See documentation here.