Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
老丢丢
SpringBoot2Demo
提交
37b2e923
S
SpringBoot2Demo
项目概览
老丢丢
/
SpringBoot2Demo
通知
3
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
S
SpringBoot2Demo
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
前往新版Gitcode,体验更适合开发者的 AI 搜索 >>
提交
37b2e923
编写于
11月 13, 2020
作者:
Q
qinxiaodong@pannk.com
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
集成Redis
上级
2246f3a9
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
124 addition
and
0 deletion
+124
-0
integrate-redis/pom.xml
integrate-redis/pom.xml
+43
-0
integrate-redis/src/main/java/com/pannk/demo/App.java
integrate-redis/src/main/java/com/pannk/demo/App.java
+43
-0
integrate-redis/src/main/java/com/pannk/demo/config/RedisConfig.java
...edis/src/main/java/com/pannk/demo/config/RedisConfig.java
+23
-0
integrate-redis/src/main/resources/application.yml
integrate-redis/src/main/resources/application.yml
+14
-0
pom.xml
pom.xml
+1
-0
未找到文件。
integrate-redis/pom.xml
0 → 100644
浏览文件 @
37b2e923
<?xml version="1.0" encoding="UTF-8"?>
<project
xmlns=
"http://maven.apache.org/POM/4.0.0"
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation=
"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
>
<parent>
<artifactId>
springboot-demo
</artifactId>
<groupId>
com.pannk
</groupId>
<version>
1.0
</version>
</parent>
<modelVersion>
4.0.0
</modelVersion>
<artifactId>
integrate-redis
</artifactId>
<dependencies>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-web
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
<exclusions>
<exclusion>
<groupId>
io.lettuce
</groupId>
<artifactId>
lettuce-core
</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>
redis.clients
</groupId>
<artifactId>
jedis
</artifactId>
</dependency>
<dependency>
<groupId>
org.projectlombok
</groupId>
<artifactId>
lombok
</artifactId>
<version>
1.18.4
</version>
</dependency>
<!--<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-pool2</artifactId>
</dependency>-->
</dependencies>
</project>
\ No newline at end of file
integrate-redis/src/main/java/com/pannk/demo/App.java
0 → 100644
浏览文件 @
37b2e923
package
com.pannk.demo
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.CommandLineRunner
;
import
org.springframework.boot.SpringApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.core.types.RedisClientInfo
;
import
java.util.List
;
/**
* Created by wolf on 20-11-13.
*/
@Slf4j
@SpringBootApplication
public
class
App
implements
CommandLineRunner
{
@Autowired
private
RedisTemplate
<
String
,
Object
>
redisTemplate
;
public
static
void
main
(
String
[]
args
)
{
SpringApplication
.
run
(
App
.
class
,
args
);
}
@Override
public
void
run
(
String
...
args
)
throws
Exception
{
/*redisTemplate.opsForValue().set("hello","Hello world redis");
String hello = (String) redisTemplate.opsForValue().get("hello");
List<RedisClientInfo> clientList = redisTemplate.getClientList();
clientList.stream().forEach(info->{
log.error("info:{}",info);
});
log.error("=========hello:{}",hello);
*/
for
(
int
i
=
0
;
i
<
1000
;
i
++)
{
new
Thread
(()
->
redisTemplate
.
opsForValue
().
set
(
"key"
+
Thread
.
currentThread
().
getName
(),
"The value is "
+
Thread
.
currentThread
().
getId
())).
start
();
}
}
}
integrate-redis/src/main/java/com/pannk/demo/config/RedisConfig.java
0 → 100644
浏览文件 @
37b2e923
package
com.pannk.demo.config
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.data.redis.connection.RedisConnectionFactory
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.data.redis.serializer.StringRedisSerializer
;
/**
* Created by wolf on 20-11-13.
*/
@Configuration
public
class
RedisConfig
{
@Bean
public
RedisTemplate
getRedisTemplate
(
RedisConnectionFactory
redisConnectionFactory
){
RedisTemplate
redisTemplate
=
new
RedisTemplate
();
redisTemplate
.
setConnectionFactory
(
redisConnectionFactory
);
redisTemplate
.
setKeySerializer
(
new
StringRedisSerializer
());
redisTemplate
.
setValueSerializer
(
new
StringRedisSerializer
());
return
redisTemplate
;
}
}
integrate-redis/src/main/resources/application.yml
0 → 100644
浏览文件 @
37b2e923
spring
:
main
:
banner-mode
:
off
redis
:
host
:
localhost
port
:
6379
password
:
database
:
0
jedis
:
pool
:
max-idle
:
10
min-idle
:
10
max-wait
:
-1ms
max-active
:
100
pom.xml
浏览文件 @
37b2e923
...
@@ -16,6 +16,7 @@
...
@@ -16,6 +16,7 @@
<module>
integrate-mybatisplus
</module>
<module>
integrate-mybatisplus
</module>
<module>
testing
</module>
<module>
testing
</module>
<module>
integrate-druid
</module>
<module>
integrate-druid
</module>
<module>
integrate-redis
</module>
</modules>
</modules>
<parent>
<parent>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录