Browse Source

不启用Redis

master
han\hanst 1 week ago
parent
commit
7c58816b12
  1. 2
      src/main/java/com/xujie/sys/common/aspect/RedisAspect.java
  2. 2
      src/main/java/com/xujie/sys/modules/pms/listener/RedisExpirationListener.java
  3. 14
      src/main/resources/application.yml

2
src/main/java/com/xujie/sys/common/aspect/RedisAspect.java

@ -22,7 +22,7 @@ import org.springframework.context.annotation.Configuration;
public class RedisAspect { public class RedisAspect {
private Logger logger = LoggerFactory.getLogger(getClass()); private Logger logger = LoggerFactory.getLogger(getClass());
//是否开启redis缓存 true开启 false关闭 //是否开启redis缓存 true开启 false关闭
@Value("${spring.redis.open: true}")
@Value("${spring.redis.open:false}")
private boolean open; private boolean open;
@Around("execution(* com.xujie.sys.common.utils.RedisUtils.*(..))") @Around("execution(* com.xujie.sys.common.utils.RedisUtils.*(..))")

2
src/main/java/com/xujie/sys/modules/pms/listener/RedisExpirationListener.java

@ -7,6 +7,7 @@ import com.xujie.sys.modules.pms.mapper.EamMapper;
import com.xujie.sys.modules.pms.service.Impl.EamServiceImpl; import com.xujie.sys.modules.pms.service.Impl.EamServiceImpl;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.data.redis.cache.CacheKeyPrefix; import org.springframework.data.redis.cache.CacheKeyPrefix;
import org.springframework.data.redis.connection.Message; import org.springframework.data.redis.connection.Message;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
@ -24,6 +25,7 @@ import java.util.List;
*/ */
@Slf4j @Slf4j
@Component @Component
@ConditionalOnProperty(prefix = "spring.redis", name = "open", havingValue = "true")
@Transactional @Transactional
public class RedisExpirationListener extends KeyExpirationEventMessageListener { public class RedisExpirationListener extends KeyExpirationEventMessageListener {
/** /**

14
src/main/resources/application.yml

@ -39,20 +39,6 @@ spring:
max-file-size: 100MB max-file-size: 100MB
max-request-size: 100MB max-request-size: 100MB
enabled: true enabled: true
data:
redis:
database: 0
password: xujieredis
host: xujiesoft.vicp.net
port: 6379
timeout: 2000ms
lettuce:
pool:
max-active: 8
max-idle: 8
min-idle: 0
max-wait: -1ms
shutdown-timeout: 100ms
mvc: mvc:
throw-exception-if-no-handler-found: true throw-exception-if-no-handler-found: true
# resources: # resources:

Loading…
Cancel
Save