From 4fad5dc3d9bd8faa5cdee7565c40c0da09e58952 Mon Sep 17 00:00:00 2001 From: xiangwbs Date: Sat, 10 Mar 2018 18:29:42 +0800 Subject: [PATCH] merge --- .../exception/UserNotLoginException.java | 28 ------------------- .../com/xwbing/redis/RedisStartupInit.java | 16 +++++------ 2 files changed, 7 insertions(+), 37 deletions(-) delete mode 100644 boot-service/src/main/java/com/xwbing/exception/UserNotLoginException.java diff --git a/boot-service/src/main/java/com/xwbing/exception/UserNotLoginException.java b/boot-service/src/main/java/com/xwbing/exception/UserNotLoginException.java deleted file mode 100644 index 933f3ee..0000000 --- a/boot-service/src/main/java/com/xwbing/exception/UserNotLoginException.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * Copyright (C) 2016 Zhejiang DRORE Technology CO.,LTD. - * All rights reserved. - * Official Web Site: http://www.drore.com. - * Developer Web Site: http://open.drore.com. - */ -package com.xwbing.exception; - -/** - * 说明: 用户系统中未登陆异常 - * 项目名称: boot-module-demo - * 创建时间: 2017/5/10 16:36 - * 作者: xiangwb - */ -public class UserNotLoginException extends RuntimeException { - private static final long serialVersionUID = -3173607918780955199L; - - - public UserNotLoginException() { - // TODO Auto-generated constructor stub - } - - public UserNotLoginException(String msg) { - super(msg); - } - - -} diff --git a/boot-service/src/main/java/com/xwbing/redis/RedisStartupInit.java b/boot-service/src/main/java/com/xwbing/redis/RedisStartupInit.java index 4759478..35f8eb4 100644 --- a/boot-service/src/main/java/com/xwbing/redis/RedisStartupInit.java +++ b/boot-service/src/main/java/com/xwbing/redis/RedisStartupInit.java @@ -8,7 +8,6 @@ import org.springframework.context.annotation.PropertySource; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import java.util.Iterator; import java.util.Set; /** @@ -30,16 +29,15 @@ public class RedisStartupInit implements InitializingBean { public void afterPropertiesSet() throws Exception { logger.info("redis has been start"); System.out.println("启动执行方法======刷新缓存=================="); - redisService.set("xwb", "测试数据"); - System.out.printf(redisService.get("xwb")); + redisService.set("test", "插入数据成功"); + logger.info("redis获取测试数据:{}",redisService.get("test")); redisService.del("xwb"); - System.out.printf(String.valueOf(redisService.exists("xwb"))); + boolean exists = redisService.exists("xwb"); + logger.info("redis测试成功:{}",!exists); Set set = redisService.keys(redisCode + "*"); - Iterator it = set.iterator(); - while (it.hasNext()) { - String keyStr = it.next(); - System.out.println("启动删除缓存名称==" + keyStr); + set.forEach(keyStr -> { + logger.info("删除缓存名称=={}",keyStr); redisService.delInit(keyStr); - } + }); } }