使用静态织法确保弹簧安全 [英] Use static weaving with spring-security
问题描述
同事, 在 spring安全文档中我遇到了以下观念:
Colleagues, In the spring security documentation I met following notion:
如果要保护不是由Spring创建的实例(使用 例如新操作符),则需要使用AspectJ.
If you want to secure instances which are not created by Spring (using the new operator, for example) then you need to use AspectJ.
任何人都可以给我看看这种用法的可行示例.最好的情况是在静态编织的帮助下完成.
Could anybody please show me workable example of such usage. The best case if this is done with help of static weaving.
提前谢谢!
推荐答案
There is an Aspectj sample in the Spring Security codebase. It compiles against the spring-security-aspects
module and then uses:
<global-method-security secured-annotations="enabled" mode="aspectj" />
to enable secured annotations. The code is very simple - it is really just a set of JUnit tests. If you take a look, you'll see that these include tests for both Spring-bean instances and instances created using the new
operator.
如果您想了解spring-security-aspects
的工作方式,请查看
If you want to know how spring-security-aspects
works, check out the aspect source.
这篇关于使用静态织法确保弹簧安全的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!