11111
This commit is contained in:
parent
f618d8e733
commit
db2e0d810a
33
src/main/java/com/example/caseData/config/RedisConfig.java
Normal file
33
src/main/java/com/example/caseData/config/RedisConfig.java
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
package com.example.caseData.config;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@Getter
|
||||||
|
public class RedisConfig {
|
||||||
|
@Value("${spring.redis.dev.host}")
|
||||||
|
private String devHost;
|
||||||
|
|
||||||
|
@Value("${spring.redis.dev.port}")
|
||||||
|
private int devPort;
|
||||||
|
|
||||||
|
@Value("${spring.redis.dev.password}")
|
||||||
|
private String devPassword;
|
||||||
|
|
||||||
|
@Value("${spring.redis.dev.database}")
|
||||||
|
private String devDatabase;
|
||||||
|
|
||||||
|
@Value("${spring.redis.prod.host}")
|
||||||
|
private String prodHost;
|
||||||
|
|
||||||
|
@Value("${spring.redis.prod.port}")
|
||||||
|
private int prodPort;
|
||||||
|
|
||||||
|
@Value("${spring.redis.prod.password}")
|
||||||
|
private String prodPassword;
|
||||||
|
|
||||||
|
@Value("${spring.redis.prod.database}")
|
||||||
|
private String prodDatabase;
|
||||||
|
}
|
||||||
@ -1,14 +1,25 @@
|
|||||||
package com.example.caseData.core;
|
package com.example.caseData.core;
|
||||||
|
|
||||||
|
import com.example.caseData.config.RedisConfig;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.data.redis.connection.lettuce.LettuceClientConfiguration;
|
||||||
import org.springframework.data.redis.core.RedisTemplate;
|
import org.springframework.data.redis.core.RedisTemplate;
|
||||||
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
import org.springframework.data.redis.connection.RedisConnectionFactory;
|
||||||
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
import org.springframework.data.redis.serializer.StringRedisSerializer;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class RedisConfig {
|
public class RedisConfiguration {
|
||||||
|
// private final RedisConfig redisConfig; // 自动注入你的配置类
|
||||||
|
//
|
||||||
|
// public RedisConfiguration(RedisConfig redisConfig) {
|
||||||
|
// this.redisConfig = redisConfig;
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
|
||||||
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
RedisTemplate<String, Object> template = new RedisTemplate<>();
|
||||||
@ -10,6 +10,6 @@ import lombok.Data;
|
|||||||
public class GetOssSignRequest {
|
public class GetOssSignRequest {
|
||||||
@NotNull(message = "错误请求")
|
@NotNull(message = "错误请求")
|
||||||
@Min(value = 1, message = "错误请求")
|
@Min(value = 1, message = "错误请求")
|
||||||
@Max(value = 1, message = "错误请求")
|
@Max(value = 2, message = "错误请求")
|
||||||
private String scene;
|
private int scene;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -12,16 +12,21 @@ spring:
|
|||||||
url: jdbc:p6spy:mysql://42.193.16.243:30001/case_data?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
|
url: jdbc:p6spy:mysql://42.193.16.243:30001/case_data?serverTimezone=UTC&useUnicode=true&characterEncoding=utf-8
|
||||||
username: root
|
username: root
|
||||||
password: gdxz123456^%$d
|
password: gdxz123456^%$d
|
||||||
data:
|
jackson:
|
||||||
redis:
|
time-zone: Asia/Shanghai
|
||||||
|
default-property-inclusion: always
|
||||||
|
redis:
|
||||||
|
dev:
|
||||||
host: '139.155.127.177'
|
host: '139.155.127.177'
|
||||||
port: 30002
|
port: 30002
|
||||||
password: gdxz2022&dj.
|
password: gdxz2022&dj.
|
||||||
database: 9
|
database: 9
|
||||||
timeout: 3000
|
prod:
|
||||||
jackson:
|
host: '139.155.127.177'
|
||||||
time-zone: Asia/Shanghai
|
port: 30002
|
||||||
default-property-inclusion: always
|
password: gdxz2022&dj.
|
||||||
|
database: 9
|
||||||
|
|
||||||
|
|
||||||
# MyBatis-Plus 配置
|
# MyBatis-Plus 配置
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user