generated from root/miduo_server
fix
parent
926c0d0414
commit
d5b3253e8d
|
@ -6,6 +6,7 @@ import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import javax.servlet.ServletContextEvent;
|
import javax.servlet.ServletContextEvent;
|
||||||
import javax.servlet.ServletContextListener;
|
import javax.servlet.ServletContextListener;
|
||||||
|
import java.io.FileInputStream;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
|
|
||||||
//创建的类名根据需要定义,但一定要实现ServletContextListener接口
|
//创建的类名根据需要定义,但一定要实现ServletContextListener接口
|
||||||
|
@ -23,11 +24,12 @@ public class WebContextListener implements ServletContextListener {
|
||||||
String osName = System.getProperty("os.name");
|
String osName = System.getProperty("os.name");
|
||||||
if (osName.matches("^(?i)Windows.*$")) {// Window 系统
|
if (osName.matches("^(?i)Windows.*$")) {// Window 系统
|
||||||
path = DEFAULT_CONFIG_PATH;
|
path = DEFAULT_CONFIG_PATH;
|
||||||
|
inputStream = getClass().getResourceAsStream(path);
|
||||||
}else{
|
}else{
|
||||||
path += "/config/jl_loginserver/application.properties";
|
path += "/config/jl_loginserver/application.properties";
|
||||||
|
inputStream = new FileInputStream(path);
|
||||||
}
|
}
|
||||||
|
LOGGER.info("WebContextListener==>path={}",path);
|
||||||
inputStream = getClass().getResourceAsStream(path);
|
|
||||||
if (inputStream != null) {
|
if (inputStream != null) {
|
||||||
BaseGlobal.getInstance().properties.load(inputStream);
|
BaseGlobal.getInstance().properties.load(inputStream);
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,8 +27,12 @@ public class RedisUtil {
|
||||||
config.setMaxWaitMillis(Integer.parseInt(properties.getProperty("redis_maxWaitMillis")));
|
config.setMaxWaitMillis(Integer.parseInt(properties.getProperty("redis_maxWaitMillis")));
|
||||||
config.setMaxIdle(Integer.parseInt(properties.getProperty("redis_maxIdle")));
|
config.setMaxIdle(Integer.parseInt(properties.getProperty("redis_maxIdle")));
|
||||||
config.setTestOnBorrow(Boolean.parseBoolean(properties.getProperty("redis_testOnBorrow")));
|
config.setTestOnBorrow(Boolean.parseBoolean(properties.getProperty("redis_testOnBorrow")));
|
||||||
|
if (properties.getProperty("redis_password") ==null || properties.getProperty("redis_password").isEmpty()){
|
||||||
|
jedisPool = new JedisPool(config, properties.getProperty("redis_host"), Integer.parseInt(properties.getProperty("redis_port")),0);
|
||||||
|
}else{
|
||||||
jedisPool = new JedisPool(config, properties.getProperty("redis_host"), Integer.parseInt(properties.getProperty("redis_port")),0,properties.getProperty("redis_password"));
|
jedisPool = new JedisPool(config, properties.getProperty("redis_host"), Integer.parseInt(properties.getProperty("redis_port")),0,properties.getProperty("redis_password"));
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/***************************************普通键值对操作***************************************/
|
/***************************************普通键值对操作***************************************/
|
||||||
//设置键值
|
//设置键值
|
||||||
|
|
Loading…
Reference in New Issue