java - AOP 与 Spring 安全

标签 java spring aop aspectj spring-aop

下面这些有什么区别...

@org.aspectj.lang.annotation.Aspect
public class Test {
   //@Pointcut, @Around etc etc..
}

public aspect Test {

}

什么是更好地用于安全......

  • Spring 安全 &
  • AOP

在 spring 应用中

最佳答案

检查 here

Aspect declarations are supported by the org.aspectj.lang.annotation.Aspect annotation. The declaration:

 @Aspect
 public class Foo {}

Is equivalent to:

 public aspect Foo {}

注意:第一个是spring检测到的。后者需要 AspectJ。

第二个问题。比较是不可能的。因为前者是框架,后者是范式。 Spring Security 使用 AOP 来保护方法调用,AOP 本身并不是一种安全机制。当然,除非您打算使用 AOP 来构建自己的安全性,这是重新发明轮子。

关于java - AOP 与 Spring 安全,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40628120/

相关文章:

java - 有人可以解释一下安装的 AspectJ 框架的 bin 目录中 aj5 和 aj 脚本的用途吗

java - 我必须使用扫描仪读取数字,并且对于每个

java - 使用 Weblogic session 复制进行内存数据库排序

java - 从 Hibernate 中的多个表中获取数据并将结果存储在 bean 中

java - 为什么没有将 javabean 功能内置到根 JAVA 对象中?

c# - Unity v3 - RegistrationByConvention - 无法加载类型异常

使用 .next() 或 .nextLine() 的 java 字符串变量

java - 理解工厂方法模式

java - 为什么在 Tomcat 和独立运行时 Spring 不注入(inject) @PersistenceContext entityManager

Spring aop 和 Jersey 类(class)