增加redis相关配置示例
This commit is contained in:
parent
68ac05fcb0
commit
02f59c18ae
@ -51,4 +51,5 @@ public class DemoController {
|
||||
log.info("现在时间:" + LocalDateTime.now());
|
||||
return flux;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -6,17 +6,26 @@ import org.hswebframework.web.authorization.Authentication;
|
||||
import org.hswebframework.web.authorization.ReactiveAuthenticationManager;
|
||||
import org.hswebframework.web.crud.service.GenericReactiveCrudService;
|
||||
import org.hswebframework.web.system.authorization.api.service.reactive.ReactiveUserService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.redis.core.ReactiveRedisTemplate;
|
||||
import org.springframework.data.redis.core.ReactiveValueOperations;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
import reactor.core.publisher.Mono;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Objects;
|
||||
|
||||
@AllArgsConstructor
|
||||
public class DemoDataService extends GenericReactiveCrudService<DemoDataEntity, String> {
|
||||
|
||||
private final ReactiveRedisTemplate reactiveRedisTemplate;
|
||||
|
||||
private final ReactiveUserService userService;
|
||||
private final ReactiveAuthenticationManager authenticationManager;
|
||||
public Mono<DemoDataEntity> findDemoDataDetail(Long id){
|
||||
ReactiveValueOperations<String, Objects> operations = reactiveRedisTemplate.opsForValue();
|
||||
Mono<Objects> obj = operations.get("key");
|
||||
return Mono.just(new DemoDataEntity());/*Mono.zip(userService.findById(id.toString()),
|
||||
this.findById(id.toString()).defaultIfEmpty(new DemoDataEntity()),
|
||||
authenticationManager.getByUserId(id.toString())
|
||||
|
||||
@ -19,6 +19,15 @@ spring:
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
redis:
|
||||
# cluster:
|
||||
# nodes:
|
||||
# - 127.0.0.1:7001
|
||||
# - 127.0.0.1:7002
|
||||
host: 192.168.8.101
|
||||
port: 6379
|
||||
password: 123456
|
||||
timeout: 5000
|
||||
r2dbc:
|
||||
#注意下面修改 easyorm相关也需要修改
|
||||
#url: r2dbc:postgresql://localhost:5432/postgres #postgresql请使用此配置
|
||||
|
||||
@ -19,12 +19,21 @@ spring:
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
redis:
|
||||
# cluster:
|
||||
# nodes:
|
||||
# - 127.0.0.1:7001
|
||||
# - 127.0.0.1:7002
|
||||
host: 192.168.8.101
|
||||
port: 6379
|
||||
password: 123456
|
||||
timeout: 5000
|
||||
r2dbc:
|
||||
#注意下面修改 easyorm相关也需要修改
|
||||
#url: r2dbc:postgresql://localhost:5432/postgres #postgresql请使用此配置
|
||||
url: r2dbc:mysql://172.24.218.235:3306/qiuguo_iot?ssl=false&serverZoneId=Asia/Shanghai # mysql请使用此配置
|
||||
#url: r2dbc:h2:file:///./data/h2db/jetlinks
|
||||
username: root
|
||||
password: !pHuRvGKIsbiqcX1
|
||||
password: '!pHuRvGKIsbiqcX1'
|
||||
device:
|
||||
tokenkey: ZGV2aWNlX2luZm9fdG9rZW5fbWQ1LTNfb2Zpa19xaXVndW8taW90LWJveCY2Mis=
|
||||
@ -19,13 +19,22 @@ spring:
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
redis:
|
||||
# cluster:
|
||||
# nodes:
|
||||
# - 127.0.0.1:7001
|
||||
# - 127.0.0.1:7002
|
||||
host: 192.168.8.101
|
||||
port: 6379
|
||||
password: 123456
|
||||
timeout: 5000
|
||||
r2dbc:
|
||||
#注意下面修改 easyorm相关也需要修改
|
||||
#url: r2dbc:postgresql://localhost:5432/postgres #postgresql请使用此配置
|
||||
url: r2dbc:mysql://172.24.218.235:3306/qiuguo_iot?ssl=false&serverZoneId=Asia/Shanghai # mysql请使用此配置
|
||||
#url: r2dbc:h2:file:///./data/h2db/jetlinks
|
||||
username: root
|
||||
password: !pHuRvGKIsbiqcX1
|
||||
password: '!pHuRvGKIsbiqcX1'
|
||||
easyorm:
|
||||
auto-ddl: true
|
||||
default-schema: qiuguo_iot # 默认使用的schema. mysql时则为数据库名
|
||||
|
||||
@ -35,6 +35,11 @@
|
||||
<artifactId>spring-boot-starter-data-r2dbc</artifactId>
|
||||
<version>2.7.15-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis-reactive</artifactId>
|
||||
<version>2.7.14</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>dev.miku</groupId>
|
||||
<artifactId>r2dbc-mysql</artifactId>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user