This commit is contained in:
2018-08-13 13:15:16 +08:00
parent 9055cf178e
commit 2dc0484a3d

View File

@@ -1,6 +1,5 @@
package com.lxyer.bbs.base; package com.lxyer.bbs.base;
import com.arangodb.Predicate;
import org.redkale.net.http.RestMapping; import org.redkale.net.http.RestMapping;
import org.redkale.service.Service; import org.redkale.service.Service;
import org.redkale.source.CacheSource; import org.redkale.source.CacheSource;
@@ -8,9 +7,6 @@ import org.redkale.source.DataSource;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.io.File; import java.io.File;
import java.util.Collection;
import java.util.List;
import java.util.Map;
/** /**
* Created by Lxy at 2017/10/3 13:50. * Created by Lxy at 2017/10/3 13:50.
@@ -19,39 +15,20 @@ public class BaseService implements Service {
protected final int sessionExpireSeconds = 7 * 24 * 60 * 60; protected final int sessionExpireSeconds = 7 * 24 * 60 * 60;
@Resource(name = "property.isDev")
public boolean isDev = true;
@Resource(name = "SERVER_ROOT") @Resource(name = "SERVER_ROOT")
protected File webroot; protected File webroot;
@Resource(name = "art123") @Resource(name = "art123")
protected DataSource source; protected DataSource source;
/* 使用redis 代码中配置此处即可 @Resource(name = "redis")
@Resource(name = "redis")*/ protected CacheSource<Integer> sessions;
@Resource(name = "cacheSource")
protected CacheSource<Long> sessions;
@Resource(name = "cacheSource") @Resource(name = "cacheSource")
protected CacheSource cacheSource; protected CacheSource cacheSource;
protected static final boolean winos = System.getProperty("os.name").contains("Window"); protected static final boolean winos = System.getProperty("os.name").contains("Window");
public static Predicate isEmpty = (x) -> {
if (x == null)
return true;
if (x instanceof List)
return ((List) x).isEmpty();
if (x instanceof String)
return ((String) x).isEmpty();
if (x instanceof Map)
return ((Map) x).isEmpty();
if (x instanceof Collection)
return ((Collection) x).isEmpty();
return false;
};
@RestMapping(ignore = true) @RestMapping(ignore = true)
public DataSource getSource() { public DataSource getSource() {
return source; return source;