commit
parent
27bff7eae6
commit
245bddd298
@ -0,0 +1,45 @@
|
||||
package com.lyr.common.core.redis;
|
||||
|
||||
|
||||
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.redisson.config.TransportMode;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* packageName com.ktg.mes.config
|
||||
*
|
||||
* @author liyc
|
||||
* @date 2024/9/3
|
||||
* @description TODO
|
||||
**/
|
||||
@Configuration
|
||||
public class RedissonConfig {
|
||||
|
||||
|
||||
@Value("${spring.redis.host}")
|
||||
private String host;
|
||||
@Value("${spring.redis.port}")
|
||||
private String port;
|
||||
@Value("${spring.redis.password}")
|
||||
private String password;
|
||||
|
||||
@Bean
|
||||
public RedissonClient redissonClient() {
|
||||
Config config = new Config();
|
||||
config.setTransportMode(TransportMode.NIO);
|
||||
SingleServerConfig singleServerConfig = config.useSingleServer();
|
||||
String address = String.format("redis://%s:%s", host, port);
|
||||
singleServerConfig.setAddress(address);
|
||||
if (StringUtils.isNotEmpty(password)) {
|
||||
singleServerConfig.setPassword(password);
|
||||
}
|
||||
RedissonClient redisson = Redisson.create(config);
|
||||
return redisson;
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
package com.lyr.gather.kis.domain.strategy;
|
||||
|
||||
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/**
|
||||
* 同步服务策略
|
||||
*/
|
||||
@Target(ElementType.TYPE)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Documented
|
||||
@Component
|
||||
public @interface Sync {
|
||||
|
||||
String value();
|
||||
|
||||
String tableName() default "";
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue