我对Spring Security和Spring Caching有疑问。说我有一个方法,并用@PreAuthorize(“ condition”)和@Cacheable(...)注释了该方法,就像这样
@PreAuthorize("some authorization check")
@Cacheable(....)
public String calculate() {
....
}
Run Code Online (Sandbox Code Playgroud)
@PreAuthorize(http://docs.spring.io/spring-security/site/docs/3.0.x/reference/ns-config.html)是否优先于@Cacheable(http://docs.spring.io/ spring / docs / 3.1.0.M1 / spring-framework-reference / html / cache.html)?框架是否保证将对@PreAuthorize安全检查进行评估,即使calculate()函数的结果已被计算和缓存也是如此?请记住,可以由用户A调用此函数,然后由缓存中存储的值调用,然后另一个用户(用户B)执行需要再次调用此函数的操作?是否会评估@PreAuthorize条件?
从我在Spring文档中可以找到的内容,@ PreAuthorize和@Cacheable的建议顺序都定义为“ Ordered.LOWEST_PRECEDENCE”,我认为这意味着它们的评估顺序是不确定的?
谢谢!