地质所 沉降监测网建设项目
zmk
2024-05-15 9e3afc6d0fa514f986d3fea40fa23124e6fb5070
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
package com.javaweb.redis.config;
import com.javaweb.redis.util.InitRedisUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
 
import javax.annotation.PostConstruct;
 
/**
 * 读取代码生成相关配置
 * 
 * @author wujiyue
 */
@Configuration
@PropertySource(value = { "classpath:redis.properties" })
public class RedisConfig {
    protected   final Logger log= LoggerFactory.getLogger(getClass());
    @Value("${redis.address}")
    protected String redisAddress;
 
    @PostConstruct
    public void initRedis(){
        log.info(">>>>>>>redisAddress:"+redisAddress);
        InitRedisUtil.init(redisAddress);
        if(InitRedisUtil.initFlag){
            log.info(">>>>>>>redis init success!");
        }else{
            log.warn(">>>>>>>redis init fail!");
        }
    }
}