我在pom.xml中添加了以下依赖项
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjrt</artifactId>
<version>1.8.5</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>1.8.5</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
并在appContext.xml中启用AspectJ,如下所示:
并定义方面如下:
@Component
@Aspect
public class AuthenticationServiceAspect {
@Before("execution(* com.service.impl.AuthenticationServiceImpl.*(..))")
public void adviceMethod(JoinPoint joinPoint) {
if(true){
throw new Exception();
}
}
Run Code Online (Sandbox Code Playgroud)
现在我想禁用这个AOP,以便上面的代码不会被执行?我怎样才能做到这一点?