2022-03-27 15:48
”重写“不是这样重写的,你这个操作叫替换,
并且undertow发布时,项目代码全部打包为jar了,
这样jfinal-undertow生产模式的ClassLoader加载器加载时就没有先后顺序了,
对业务jar一视同仁,你项目代码的jar 和 jf的jar 该类会冲突。
其次 jfinal 的Cache 也没有 setexStr 吧?以前有?
正常应该是:
public class MyCache extends com.jfinal.plugin.redis.Cache {
@Override
public String setex(Object key, int seconds, Object value) {
return xxx;
}
xxxx
}
直接启动设置:
Cache cache = new MyCache(cacheName, jedisPool, serializer, keyNamingPolicy);
Redis.addCache(cache);
或者用RedisPlugin启动设置:
new RedisPlugin(xxx){
@Override
public boolean start() {
复制RedisPlugin里面的start代码过来
Cache cache = new MyCache(this.cacheName, jedisPool, this.serializer, this.keyNamingPolicy);
Redis.addCache(cache);
return true;
}
};
业务中使用:
MyCache cache = (MyCache)Redis.use();
cache.xxx 可以调用自己定义的方法,JF的Cache没有定义得方法都可以调用了
2022-03-03 10:30
@zzutligang 昂,是HTML啊,看茬了,那用 axios 发起请求就可以了,还是自己封装一下,里面随便切换请求工具:
https://www.runoob.com/vue3/vue3-ajax-axios.html
2022-02-28 17:42
https://jfinal.com/doc/5-14
new ActiveRecordPlugin("这个值", dsMysql)
Db.use("这个值").find(XXX
如果他是第一个启动的ActiveRecordPlugin插件,
那么Db.use() 这个主配置的name就是 "这个值" ,不是"main"了。
PS代码:
/**
* Replace the main config if current config name is MAIN_CONFIG_NAME
*/
if (MAIN_CONFIG_NAME.equals(config.getName())) {
DbKit.config = config;
Db.init(DbKit.config.getName());
}
/**
* The configName may not be MAIN_CONFIG_NAME,
* the main config have to set the first comming Config if it is null
*/
if (DbKit.config == null) {
DbKit.config = config;
Db.init(DbKit.config.getName());
}