From 0a21cb98217715e5775d76b34500b9f3f98c8e1e Mon Sep 17 00:00:00 2001 From: laixiongwei <491201280@qq.com> Date: Tue, 22 Aug 2023 18:58:36 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E7=90=86=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ms-biz/pom.xml | 8 ++--- .../com/ms/api/paas/RedisDemoService.java | 35 ++++++++++--------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/ms-biz/pom.xml b/ms-biz/pom.xml index 3f21b7b6..896d725e 100644 --- a/ms-biz/pom.xml +++ b/ms-biz/pom.xml @@ -23,10 +23,10 @@ - - org.springframework.boot - spring-boot-starter-data-redis - + + + + diff --git a/ms-biz/src/main/java/com/ms/api/paas/RedisDemoService.java b/ms-biz/src/main/java/com/ms/api/paas/RedisDemoService.java index 0bb96c8a..638a522a 100644 --- a/ms-biz/src/main/java/com/ms/api/paas/RedisDemoService.java +++ b/ms-biz/src/main/java/com/ms/api/paas/RedisDemoService.java @@ -15,21 +15,24 @@ import java.util.concurrent.TimeUnit; */ @Slf4j //@Component -public class RedisDemoService implements ApplicationListener { - @Autowired - private RedisTemplate redisTemplate; +public class RedisDemoService { - private static final String DEBUG_KEY = "ContextRefreshedEventTime"; - - public void setKey() { - redisTemplate.opsForValue().set(DEBUG_KEY, String.valueOf(System.currentTimeMillis()), 1, TimeUnit.MINUTES); - - String value = redisTemplate.opsForValue().get(DEBUG_KEY); - log.info("RedisDemoService get value:" + value); - } - - @Override - public void onApplicationEvent(ContextRefreshedEvent event) { - setKey(); - } } +//public class RedisDemoService implements ApplicationListener { +// @Autowired +// private RedisTemplate redisTemplate; +// +// private static final String DEBUG_KEY = "ContextRefreshedEventTime"; +// +// public void setKey() { +// redisTemplate.opsForValue().set(DEBUG_KEY, String.valueOf(System.currentTimeMillis()), 1, TimeUnit.MINUTES); +// +// String value = redisTemplate.opsForValue().get(DEBUG_KEY); +// log.info("RedisDemoService get value:" + value); +// } +// +// @Override +// public void onApplicationEvent(ContextRefreshedEvent event) { +// setKey(); +// } +//}