Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
amos-boot-biz
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
项目统一框架
amos-boot-biz
Commits
4c163d7b
Commit
4c163d7b
authored
Aug 29, 2023
by
suhuiguang
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.bug
parent
4fc767c5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
35 additions
and
13 deletions
+35
-13
RedissonManager.java
...amos/boot/module/elevator/biz/config/RedissonManager.java
+10
-4
RedissonManager.java
...join/amos/boot/module/ymt/biz/config/RedissonManager.java
+25
-9
No files found.
amos-boot-system-tzs/amos-boot-module-96333/amos-boot-module-96333-biz/src/main/java/com/yeejoin/amos/boot/module/elevator/biz/config/RedissonManager.java
View file @
4c163d7b
...
@@ -30,19 +30,25 @@ public class RedissonManager {
...
@@ -30,19 +30,25 @@ public class RedissonManager {
/**
/**
* 单机环境使用
* 单机环境使用
*/
*/
@Value
(
"${spring.redis.host
:default
}"
)
@Value
(
"${spring.redis.host}"
)
private
String
host
;
private
String
host
;
/**
/**
* 单机环境使用
* 单机环境使用
*/
*/
@Value
(
"${spring.redis.port
:default
}"
)
@Value
(
"${spring.redis.port}"
)
private
String
port
;
private
String
port
;
/**
* 单机环境使用
*/
@Value
(
"${spring.redis.database}"
)
private
int
database
;
@Bean
@Bean
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"cluster"
)
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"cluster"
)
public
RedissonClient
redissonClient
()
{
public
RedissonClient
redissonClient
()
{
// 集群环境使用
Config
config
=
new
Config
();
Config
config
=
new
Config
();
config
.
useClusterServers
()
config
.
useClusterServers
()
.
addNodeAddress
(
clusterNodes
.
split
(
","
))
.
addNodeAddress
(
clusterNodes
.
split
(
","
))
...
@@ -55,7 +61,7 @@ public class RedissonManager {
...
@@ -55,7 +61,7 @@ public class RedissonManager {
public
RedissonClient
redissonSingletonClient
()
{
public
RedissonClient
redissonSingletonClient
()
{
// 单机打包使用
// 单机打包使用
Config
config
=
new
Config
();
Config
config
=
new
Config
();
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
);
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
)
.
setDatabase
(
database
)
;
return
Redisson
.
create
(
config
);
return
Redisson
.
create
(
config
);
}
}
}
}
amos-boot-system-tzs/amos-boot-module-ymt/amos-boot-module-ymt-biz/src/main/java/com/yeejoin/amos/boot/module/ymt/biz/config/RedissonManager.java
View file @
4c163d7b
...
@@ -10,30 +10,46 @@ import org.springframework.context.annotation.Bean;
...
@@ -10,30 +10,46 @@ import org.springframework.context.annotation.Bean;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
@Configuration
@Configuration
@Slf4j
@Slf4j
public
class
RedissonManager
{
public
class
RedissonManager
{
//集群环境使用
/**
* 集群环境使用-节点信息
*/
@Value
(
"${spring.redis.cluster.nodes:default}"
)
@Value
(
"${spring.redis.cluster.nodes:default}"
)
private
String
clusterNodes
;
private
String
clusterNodes
;
//通用
/**
* 公共-密码
*/
@Value
(
"${spring.redis.password}"
)
@Value
(
"${spring.redis.password}"
)
private
String
password
;
private
String
password
;
//单机环境使用
/**
@Value
(
"${spring.redis.host:default}"
)
* 单机环境使用-host
*/
@Value
(
"${spring.redis.host}"
)
private
String
host
;
private
String
host
;
//单机环境使用
/**
@Value
(
"${spring.redis.port:default}"
)
* 单机环境使用
*/
@Value
(
"${spring.redis.port}"
)
private
String
port
;
private
String
port
;
/**
* 单机环境使用
*/
@Value
(
"${spring.redis.database}"
)
private
int
database
;
@Bean
@Bean
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"cluster"
)
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"cluster"
)
public
RedissonClient
redissonClient
()
{
public
RedissonClient
redissonClient
()
{
// 集群环境使用
Config
config
=
new
Config
();
Config
config
=
new
Config
();
config
.
useClusterServers
()
config
.
useClusterServers
()
.
addNodeAddress
(
clusterNodes
.
split
(
","
))
.
addNodeAddress
(
clusterNodes
.
split
(
","
))
...
@@ -44,9 +60,9 @@ public class RedissonManager {
...
@@ -44,9 +60,9 @@ public class RedissonManager {
@Bean
@Bean
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"singleton"
,
matchIfMissing
=
true
)
@ConditionalOnProperty
(
name
=
"spring.redis.mode"
,
havingValue
=
"singleton"
,
matchIfMissing
=
true
)
public
RedissonClient
redissonSingletonClient
()
{
public
RedissonClient
redissonSingletonClient
()
{
// 单机
打包
使用
// 单机
环境
使用
Config
config
=
new
Config
();
Config
config
=
new
Config
();
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
);
config
.
useSingleServer
().
setAddress
(
host
+
":"
+
port
).
setPassword
(
password
)
.
setDatabase
(
database
)
;
return
Redisson
.
create
(
config
);
return
Redisson
.
create
(
config
);
}
}
}
}
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