Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Q
qk_backend
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
quanku
qk_backend
Commits
37283bda
Commit
37283bda
authored
Aug 21, 2023
by
shiyu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
redis配置
parent
e7f337bd
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
785 additions
and
0 deletions
+785
-0
ch-core/pom.xml
ch-core/pom.xml
+12
-0
ch-core/src/main/java/com/wwdz/ch/core/config/RedissonConfig.java
...src/main/java/com/wwdz/ch/core/config/RedissonConfig.java
+47
-0
ch-core/src/main/java/com/wwdz/ch/core/util/RedisUtils.java
ch-core/src/main/java/com/wwdz/ch/core/util/RedisUtils.java
+726
-0
No files found.
ch-core/pom.xml
View file @
37283bda
...
...
@@ -118,6 +118,18 @@
<artifactId>
spring-boot-starter-data-redis
</artifactId>
</dependency>
<dependency>
<groupId>
org.springframework.data
</groupId>
<artifactId>
spring-data-redis
</artifactId>
<version>
2.1.5.RELEASE
</version>
</dependency>
<dependency>
<groupId>
org.redisson
</groupId>
<artifactId>
redisson
</artifactId>
<version>
3.11.3
</version>
</dependency>
<dependency>
<groupId>
org.apache.commons
</groupId>
<artifactId>
commons-pool2
</artifactId>
...
...
ch-core/src/main/java/com/wwdz/ch/core/config/RedissonConfig.java
0 → 100644
View file @
37283bda
package
com.wwdz.ch.core.config
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.redisson.Redisson
;
import
org.redisson.api.RedissonClient
;
import
org.redisson.config.Config
;
import
org.redisson.config.SingleServerConfig
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* redisson 配置类
* Created by xy on 2019/3/9.
*/
@Configuration
@Slf4j
public
class
RedissonConfig
{
Logger
logger
=
LoggerFactory
.
getLogger
(
RedissonConfig
.
class
);
@Value
(
"${spring.redis.host}"
)
private
String
host
;
@Value
(
"${spring.redis.port}"
)
private
String
port
;
@Value
(
"${spring.redis.password}"
)
private
String
password
;
@Bean
public
RedissonClient
getRedisson
(){
logger
.
info
(
"redis://"
+
host
+
":"
+
port
);
Config
config
=
new
Config
();
SingleServerConfig
singleServerConfig
=
config
.
useSingleServer
();
singleServerConfig
.
setAddress
(
"redis://"
+
host
+
":"
+
port
);
if
(
StringUtils
.
isNotEmpty
(
password
))
{
singleServerConfig
.
setPassword
(
password
);
}
return
Redisson
.
create
(
config
);
}
}
ch-core/src/main/java/com/wwdz/ch/core/util/RedisUtils.java
0 → 100644
View file @
37283bda
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment