diff --git a/blog-core/src/main/java/com/zyd/blog/business/aspect/RedisCacheAspect.java b/blog-core/src/main/java/com/zyd/blog/business/aspect/RedisCacheAspect.java index 7938f3040143d589b1adf59c6c3718c928a4cb8d..949e84513e99c310e2c4c22b9973e41203ece918 100644 --- a/blog-core/src/main/java/com/zyd/blog/business/aspect/RedisCacheAspect.java +++ b/blog-core/src/main/java/com/zyd/blog/business/aspect/RedisCacheAspect.java @@ -2,6 +2,7 @@ package com.zyd.blog.business.aspect; import com.zyd.blog.business.annotation.RedisCache; import com.zyd.blog.business.service.RedisService; +import com.zyd.blog.framework.property.AppProperties; import com.zyd.blog.util.AspectUtil; import lombok.extern.slf4j.Slf4j; import org.aspectj.lang.ProceedingJoinPoint; @@ -31,6 +32,8 @@ public class RedisCacheAspect { @Autowired private RedisService redisService; + @Autowired + private AppProperties appProperties; @Pointcut(value = "@annotation(com.zyd.blog.business.annotation.RedisCache)") public void pointcut() { @@ -38,6 +41,9 @@ public class RedisCacheAspect { @Around("pointcut()") public Object handle(ProceedingJoinPoint point) throws Throwable { + if (!appProperties.isEnableRedisCache()) { + return point.proceed(); + } Method currentMethod = AspectUtil.INSTANCE.getMethod(point); //获取操作名称 RedisCache cache = currentMethod.getAnnotation(RedisCache.class);