技术点:采用 SpringMVC3+Spring3+Hibernate3+Freemarker 主流技术架构

生成入口方法
package com.jeecms.cms.template; public class CmsModuleGenerator {
private static String packName = "com.jeecms.cms.template";
private static String fileName = "jeecms.properties"; public static void main(String[] args) {
new ModuleGenerator(packName, fileName).generate();
}
}
生成方法
package com.jeecms.cms.template; import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Properties;
import java.util.Set; import org.apache.commons.io.FileUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory; /**
* 模块生成器
*
* <p>
* 用于生成JEE模块。
* <p>
* 包括JAVA类:action,dao,dao.impl,manager,manager.impl;
* 配置文件:action配置,spring配置;ftl页面:list.html,add.html,edit.html。
* 数据验证文件:Act-Com_save
* -validation.xml,Act-Com_edit-validation.xml,Act-Com_update-validation.xml
* <p>
* 可设置的参数有:模块实体类名、java类包地址、配置文件地址、ftl页面地址。
*/
public class ModuleGenerator {
private static final Logger log = LoggerFactory
.getLogger(ModuleGenerator.class);
public static final String SPT = File.separator; public static final String ENCODING = "UTF-8"; private Properties prop = new Properties(); private String packName;
private String fileName;
private File daoImplFile;
private File daoFile;
private File managerFile;
private File managerImplFile;
private File actionFile;
private File pageListFile;
private File pageEditFile;
private File pageAddFile; private File daoImplTpl;
private File daoTpl;
private File managerTpl;
private File managerImplTpl;
private File actionTpl;
private File pageListTpl;
private File pageEditTpl;
private File pageAddTpl; public ModuleGenerator(String packName, String fileName) {
this.packName = packName;
this.fileName = fileName;
} @SuppressWarnings("unchecked")
private void loadProperties() {
try {
log.debug("packName=" + packName);
log.debug("fileName=" + fileName);
FileInputStream fileInput = new FileInputStream(getFilePath(
packName, fileName));
prop.load(fileInput);
String entityUp = prop.getProperty("Entity");
log.debug("entityUp:" + entityUp);
if (entityUp == null || entityUp.trim().equals("")) {
log.warn("Entity not specified, exit!");
return;
}
String entityLow = entityUp.substring(, ).toLowerCase()
+ entityUp.substring();
log.debug("entityLow:" + entityLow);
prop.put("entity", entityLow);
if (log.isDebugEnabled()) {
Set ps = prop.keySet();
for (Object o : ps) {
log.debug(o + "=" + prop.get(o));
}
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
} private void prepareFile() {
String daoImplFilePath = getFilePath(prop.getProperty("dao_impl_p"),
prop.getProperty("Entity") + "DaoImpl.java");
daoImplFile = new File(daoImplFilePath);
log.debug("daoImplFile:" + daoImplFile.getAbsolutePath()); String daoFilePath = getFilePath(prop.getProperty("dao_p"), prop
.getProperty("Entity")
+ "Dao.java");
daoFile = new File(daoFilePath);
log.debug("daoFile:" + daoFile.getAbsolutePath()); String managerFilePath = getFilePath(prop.getProperty("manager_p"),
prop.getProperty("Entity") + "Mng.java");
managerFile = new File(managerFilePath);
log.debug("managerFile:" + managerFile.getAbsolutePath()); String managerImplFilePath = getFilePath(prop
.getProperty("manager_impl_p"), prop.getProperty("Entity")
+ "MngImpl.java");
managerImplFile = new File(managerImplFilePath);
log.debug("managerImplFile:" + managerImplFile.getAbsolutePath());
String actionFilePath = getFilePath(prop.getProperty("action_p"), prop
.getProperty("Entity")
+ "Act.java");
actionFile = new File(actionFilePath);
log.debug("actionFile:" + actionFile.getAbsolutePath()); String pagePath = "WebContent/WEB-INF/"
+ prop.getProperty("config_sys") + "/"
+ prop.getProperty("config_entity") + "/";
pageListFile = new File(pagePath + "list.html");
log.debug("pageListFile:" + pageListFile.getAbsolutePath());
pageEditFile = new File(pagePath + "edit.html");
log.debug("pageEditFile:" + pageEditFile.getAbsolutePath());
pageAddFile = new File(pagePath + "add.html");
log.debug("pageAddFile:" + pageAddFile.getAbsolutePath());
} private void prepareTemplate() {
String tplPack = prop.getProperty("template_dir");
log.debug("tplPack:" + tplPack);
daoImplTpl = new File(getFilePath(tplPack, "dao_impl.txt"));
daoTpl = new File(getFilePath(tplPack, "dao.txt"));
managerImplTpl = new File(getFilePath(tplPack, "manager_impl.txt"));
managerTpl = new File(getFilePath(tplPack, "manager.txt"));
actionTpl = new File(getFilePath(tplPack, "action.txt"));
pageListTpl = new File(getFilePath(tplPack, "page_list.txt"));
pageAddTpl = new File(getFilePath(tplPack, "page_add.txt"));
pageEditTpl = new File(getFilePath(tplPack, "page_edit.txt"));
} private static void stringToFile(File file, String s) throws IOException {
FileUtils.writeStringToFile(file, s, ENCODING);
} private void writeFile() {
try {
if ("true".equals(prop.getProperty("is_dao"))) {
stringToFile(daoImplFile, readTpl(daoImplTpl));
stringToFile(daoFile, readTpl(daoTpl));
}
if ("true".equals(prop.getProperty("is_manager"))) {
stringToFile(managerImplFile, readTpl(managerImplTpl));
stringToFile(managerFile, readTpl(managerTpl));
}
if ("true".equals(prop.getProperty("is_action"))) {
stringToFile(actionFile, readTpl(actionTpl));
}
if ("true".equals(prop.getProperty("is_page"))) {
stringToFile(pageListFile, readTpl(pageListTpl));
stringToFile(pageAddFile, readTpl(pageAddTpl));
stringToFile(pageEditFile, readTpl(pageEditTpl));
}
} catch (IOException e) {
log.warn("write file faild! " + e.getMessage());
}
} private String readTpl(File tpl) {
String content = null;
try {
content = FileUtils.readFileToString(tpl, ENCODING);
Set<Object> ps = prop.keySet();
for (Object o : ps) {
String key = (String) o;
String value = prop.getProperty(key);
content = content.replaceAll("\\#\\{" + key + "\\}", value);
}
} catch (IOException e) {
log.warn("read file faild. " + e.getMessage());
}
return content; } private String getFilePath(String packageName, String name) {
log.debug("replace:" + packageName);
String path = packageName.replaceAll("\\.", "/");
log.debug("after relpace:" + path);
return "src/" + path + "/" + name;
} public void generate() {
loadProperties();
prepareFile();
prepareTemplate();
writeFile();
} public static void main(String[] args) {
String packName = "com.jeecms.common.developer.template";
String fileName = "template.properties";
new ModuleGenerator(packName, fileName).generate();
}
}
Entity 模板
使用hibernateMapping插件生成
Dao 模板
​ dao.txt package #{dao_p}; import com.jeecms.common.hibernate4.Updater;
import com.jeecms.common.page.Pagination;
import #{entity_p}.#{Entity}; public interface #{Entity}Dao {
public Pagination getPage(int pageNo, int pageSize); public #{Entity} findById(Integer id); public #{Entity} save(#{Entity} bean); public #{Entity} updateByUpdater(Updater<#{Entity}> updater); public #{Entity} deleteById(Integer id);
}
DaoImpl 模板
​ dao_impl.txt package #{dao_impl_p}; import org.hibernate.Criteria;
import org.springframework.stereotype.Repository; import com.jeecms.common.hibernate4.HibernateBaseDao;
import com.jeecms.common.page.Pagination;
import #{dao_p}.#{Entity}Dao;
import #{entity_p}.#{Entity}; @Repository
public class #{Entity}DaoImpl extends HibernateBaseDao<#{Entity}, Integer> implements #{Entity}Dao {
public Pagination getPage(int pageNo, int pageSize) {
Criteria crit = createCriteria();
Pagination page = findByCriteria(crit, pageNo, pageSize);
return page;
} public #{Entity} findById(Integer id) {
#{Entity} entity = get(id);
return entity;
} public #{Entity} save(#{Entity} bean) {
getSession().save(bean);
return bean;
} public #{Entity} deleteById(Integer id) {
#{Entity} entity = super.get(id);
if (entity != null) {
getSession().delete(entity);
}
return entity;
} @Override
protected Class<#{Entity}> getEntityClass() {
return #{Entity}.class;
}
}
Manager 模板
​ manager.txt package #{manager_p}; import com.jeecms.common.page.Pagination;
import #{entity_p}.#{Entity}; public interface #{Entity}Mng {
public Pagination getPage(int pageNo, int pageSize); public #{Entity} findById(Integer id); public #{Entity} save(#{Entity} bean); public #{Entity} update(#{Entity} bean); public #{Entity} deleteById(Integer id); public #{Entity}[] deleteByIds(Integer[] ids);
}
ManagerImpl 模板
​ manager_impl.txt package #{manager_impl_p}; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import com.jeecms.common.hibernate4.Updater;
import com.jeecms.common.page.Pagination;
import #{dao_p}.#{Entity}Dao;
import #{entity_p}.#{Entity};
import #{manager_p}.#{Entity}Mng; @Service
@Transactional
public class #{Entity}MngImpl implements #{Entity}Mng {
@Transactional(readOnly = true)
public Pagination getPage(int pageNo, int pageSize) {
Pagination page = dao.getPage(pageNo, pageSize);
return page;
} @Transactional(readOnly = true)
public #{Entity} findById(Integer id) {
#{Entity} entity = dao.findById(id);
return entity;
} public #{Entity} save(#{Entity} bean) {
dao.save(bean);
return bean;
} public #{Entity} update(#{Entity} bean) {
Updater<#{Entity}> updater = new Updater<#{Entity}>(bean);
bean = dao.updateByUpdater(updater);
return bean;
} public #{Entity} deleteById(Integer id) {
#{Entity} bean = dao.deleteById(id);
return bean;
} public #{Entity}[] deleteByIds(Integer[] ids) {
#{Entity}[] beans = new #{Entity}[ids.length];
for (int i = ,len = ids.length; i < len; i++) {
beans[i] = deleteById(ids[i]);
}
return beans;
} private #{Entity}Dao dao; @Autowired
public void setDao(#{Entity}Dao dao) {
this.dao = dao;
}
}
Action 模板
​ action.txt package #{action_p}; import static com.jeecms.common.page.SimplePage.cpn; import javax.servlet.http.HttpServletRequest; import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping; import #{entity_p}.#{Entity};
import com.jeecms.core.entity.CmsSite;
import #{manager_p}.#{Entity}Mng;
import com.jeecms.core.web.util.CmsUtils;
import com.jeecms.core.web.WebErrors;
import com.jeecms.common.page.Pagination;
import com.jeecms.common.web.CookieUtils; @Controller
public class #{Entity}Act {
private static final Logger log = LoggerFactory.getLogger(#{Entity}Act.class); @RequiresPermissions("#{config_entity}:v_list")
@RequestMapping("/#{config_entity}/v_list.do")
public String list(Integer pageNo, HttpServletRequest request, ModelMap model) {
Pagination pagination = manager.getPage(cpn(pageNo), CookieUtils
.getPageSize(request));
model.addAttribute("pagination",pagination);
model.addAttribute("pageNo",pagination.getPageNo());
return "#{config_entity}/list";
} @RequiresPermissions("#{config_entity}:v_add")
@RequestMapping("/#{config_entity}/v_add.do")
public String add(ModelMap model) {
return "#{config_entity}/add";
} @RequiresPermissions("#{config_entity}:v_edit")
@RequestMapping("/#{config_entity}/v_edit.do")
public String edit(Integer id, Integer pageNo, HttpServletRequest request, ModelMap model) {
WebErrors errors = validateEdit(id, request);
if (errors.hasErrors()) {
return errors.showErrorPage(model);
}
model.addAttribute("#{entity}", manager.findById(id));
model.addAttribute("pageNo",pageNo);
return "#{config_entity}/edit";
} @RequiresPermissions("#{config_entity}:o_save")
@RequestMapping("/#{config_entity}/o_save.do")
public String save(#{Entity} bean, HttpServletRequest request, ModelMap model) {
WebErrors errors = validateSave(bean, request);
if (errors.hasErrors()) {
return errors.showErrorPage(model);
}
bean = manager.save(bean);
log.info("save #{Entity} id={}", bean.getId());
return "redirect:v_list.do";
} @RequiresPermissions("#{config_entity}:o_update")
@RequestMapping("/#{config_entity}/o_update.do")
public String update(#{Entity} bean, Integer pageNo, HttpServletRequest request,
ModelMap model) {
WebErrors errors = validateUpdate(bean.getId(), request);
if (errors.hasErrors()) {
return errors.showErrorPage(model);
}
bean = manager.update(bean);
log.info("update #{Entity} id={}.", bean.getId());
return list(pageNo, request, model);
} @RequiresPermissions("#{config_entity}:o_delete")
@RequestMapping("/#{config_entity}/o_delete.do")
public String delete(Integer[] ids, Integer pageNo, HttpServletRequest request,
ModelMap model) {
WebErrors errors = validateDelete(ids, request);
if (errors.hasErrors()) {
return errors.showErrorPage(model);
}
#{Entity}[] beans = manager.deleteByIds(ids);
for (#{Entity} bean : beans) {
log.info("delete #{Entity} id={}", bean.getId());
}
return list(pageNo, request, model);
} private WebErrors validateSave(#{Entity} bean, HttpServletRequest request) {
WebErrors errors = WebErrors.create(request);
CmsSite site = CmsUtils.getSite(request);
bean.setSite(site);
return errors;
} private WebErrors validateEdit(Integer id, HttpServletRequest request) {
WebErrors errors = WebErrors.create(request);
CmsSite site = CmsUtils.getSite(request);
if (vldExist(id, site.getId(), errors)) {
return errors;
}
return errors;
} private WebErrors validateUpdate(Integer id, HttpServletRequest request) {
WebErrors errors = WebErrors.create(request);
CmsSite site = CmsUtils.getSite(request);
if (vldExist(id, site.getId(), errors)) {
return errors;
}
return errors;
} private WebErrors validateDelete(Integer[] ids, HttpServletRequest request) {
WebErrors errors = WebErrors.create(request);
CmsSite site = CmsUtils.getSite(request);
if (errors.ifEmpty(ids, "ids")) {
return errors;
}
for (Integer id : ids) {
vldExist(id, site.getId(), errors);
}
return errors;
} private boolean vldExist(Integer id, Integer siteId, WebErrors errors) {
if (errors.ifNull(id, "id")) {
return true;
}
#{Entity} entity = manager.findById(id);
if(errors.ifNotExist(entity, #{Entity}.class, id)) {
return true;
}
if (!entity.getSite().getId().equals(siteId)) {
errors.notInSite(#{Entity}.class, id);
return true;
}
return false;
} @Autowired
private #{Entity}Mng manager;
}
页面增加模板
​ page_add.txt <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/#{config_sys}/head.html"/>
<script type="text/javascript">
$(function() {
$("#jvForm").validate();
});
</script>
</head>
<body>
<div class="box-positon">
<div class="rpos"><@s.m "global.position"/>: <@s.m "#{entity}.function"/> - <@s.m "global.add"/></div>
<form class="ropt">
<input class="return-button" type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='v_list.do';"/>
</form>
<div class="clear"></div>
</div>
<div class="body-box">
<@p.form id="jvForm" action="o_save.do">
<@p.text label="#{entity}.name" name="name" required="true" class="required" maxlength=""/>
<@p.td><@p.submit code="global.submit"/> &nbsp; <@p.reset code="global.reset"/></@p.td>
</@p.form>
</div>
</body>
</html>
页面修改模板
​ page_edit.txt <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/#{config_sys}/head.html"/>
<script type="text/javascript">
$(function() {
$("#jvForm").validate();
});
</script>
</head>
<body>
<div class="box-positon">
<div class="rpos"><@s.m "global.position"/>: <@s.m "#{entity}.function"/> - <@s.m "global.edit"/></div>
<form class="ropt">
<input class="return-button" type="submit" value="<@s.m "global.backToList"/>" onclick="this.form.action='v_list.do';"/>
</form>
<div class="clear"></div>
</div>
<div class="body-box">
<@p.form id="jvForm" action="o_update.do">
<@p.text label="#{entity}.name" name="name" value=#{entity}.name required="true" class="required" maxlength=""/>
<@p.td><@p.hidden name="id" value=#{entity}.id/><@p.submit code="global.submit"/> &nbsp; <@p.reset code="global.reset"/></@p.td>
</@p.form>
</div>
</body>
</html>
页面列表模板
​ page_list.txt <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/#{config_sys}/head.html"/>
<script type="text/javascript">
function getTableForm() {
return document.getElementById('tableForm');
}
function optDelete() {
if(Pn.checkedCount('ids')<=) {
$.alert("<@s.m 'global.prompt'/>","<@s.m 'error.checkRecord'/>");
return;
}
$.confirm(doDelete,"<@s.m 'global.confirm'/>","<@s.m 'global.confirm.delete'/>");
}
function doDelete(){
var f = getTableForm();
f.action="o_delete.do";
f.submit();
}
</script>
</head>
<body>
<div class="box-positon">
<div class="rpos"><@s.m "global.position"/>: <@s.m "#{entity}.function"/> - <@s.m "global.list"/></div>
<form class="ropt">
<input class="add" type="submit" value="<@s.m "global.add"/>" onclick="this.form.action='v_add.do';"/>
</form>
<div class="clear"></div>
</div>
<div class="body-box">
<form id="tableForm" method="post">
<input type="hidden" name="pageNo" value="${pageNo!}"/>
<@p.table value=pagination;#{entity},i,has_next><#rt/>
<@p.column title="<input type='checkbox' onclick='Pn.checkbox(\"ids\",this.checked)'/>" width="">
<input type='checkbox' name='ids' value='${#{entity}.id}'/><#t/>
</@p.column><#t/>
<@p.column title="ID">${#{entity}.id}</@p.column><#t/>
<@p.column code="#{entity}.name">${#{entity}.name}</@p.column><#t/>
<@p.column code="global.operate" align="center">
<a href="v_edit.do?id=${#{entity}.id}&pageNo=${pageNo!}" class="pn-opt"><@s.m "global.edit"/></a> | <#rt/>
<a href="o_delete.do?ids=${#{entity}.id}&pageNo=${pageNo!}" onclick="if(!$.confirmToUrl(this.href)) {return false;}" class="pn-opt"><@s.m "global.delete"/></a><#t/>
</@p.column><#t/>
</@p.table>
<div><input class="del-button" type="button" value="<@s.m "global.delete"/>" onclick="optDelete();"/></div>
</form>
</div>
<#include "/common/alert_message.html"/>
</body>
</html>
使用
com.jeecms.cms.template.CmsModuleGenerator.java打开后Run As—java application Donate comment here
打赏
本文作者: IIsKei
本文链接: http://www.iskei.cn/posts/50510.html
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!

jeecms 代码生成 Tools的更多相关文章

  1. 代码生成工具——Entity Framework Power Tools

    Entity Framework Power Tools是VS上的一个根据数据库生成Model的Code First映射工具.在VS里面右键即可看到.什么,没有? 别慌,可以单独下载的,见 https ...

  2. StartUML反向(逆向)Java工程通过代码生成类图

     在软件工程中,通过都是先了详细设计,然后按照详细设计来进行开发.在编写详细设计的时候,通常都会画一些类图.时序图.流程图等等UML设计,然后通过uml类图生成代码,这个属于正向工程生成代码,然而在实 ...

  3. 配置VS代码生成工具ReSharper快捷键

    VS代码生成工具ReSharper提供了丰富的快捷键,可以极大地提高你的开发效率.安装ReSharper后首次启动Visual Studio时,会出现一个名为ReSharper Keyboard Sc ...

  4. phalcon: Windows 下 Phalcon dev-tools 配置 和 Phpstorm中配置Phalcon 代码提示, phalcon tools的使用

    准备: phalcon-devtools包 下载地址: https://github.com/phalcon/phalcon-devtools 解压到wampserver的www目录 (xampp 用 ...

  5. 如何在linux中搭建JEECMS系统

    本人正在进行jeecms二次开发,但因win7系统中的Tomcat无法使用,就想起在linux下安装,但去jeecms的官方网站,没有给出在linux下安装的方法,确实苦恼,经过一天的研究,终于大功告 ...

  6. VS代码生成工具ReSharper使用手册:配置快捷键

    原文 http://www.cnblogs.com/PHPIDE/archive/2013/05/16/3081783.html VS代码生成工具ReSharper提供了丰富的快捷键,可以极大地提高你 ...

  7. EF POWER TOOLS由数据库逆向CODE FIRST

    EF POWER TOOLS由数据库逆向CODE FIRST 前言 利用db first的开发方式有很多可供选择的方案,一种可以用ado.net实体框架模型,由向导直接生成edmx,并生成数据库上下文 ...

  8. VS代码生成工具ReSharper使用手册:配置快捷键(转)

    原文:http://blog.csdn.net/fhzh520/article/details/46364603 VS代码生成工具ReSharper提供了丰富的快捷键,可以极大地提高你的开发效率. 配 ...

  9. yaf代码生成工具的使用

    具体步骤如下: 1.下载php-yaf源码: git clone https://github.com/laruence/php-yaf/ 2.运行代码生成工具: /Users/helloxiaozh ...

随机推荐

  1. Codeforces Round #526 D - The Fair Nut and the Best Path /// 树上两点间路径花费

    题目大意: 给定一棵树 树上每个点有对应的点权 树上每条边有对应的边权 经过一个点可得到点权 经过一条边必须花费边权 即从u到v 最终得分=u的点权-u到v的边权+v的点权 求树上一条路径使得得分最大 ...

  2. 在CentOS6上安装mysql5.7报错

    报错截图: 处理方法: # yum install numactl perl -y

  3. 使用雪碧图Css Sprite精灵 | 加速网页响应速度

    什么是CSS Sprite精灵? 是用于前端的一种图片应用技术,通常情况,我们的开发的网页或许有很多张图片,假如在一个页面上有50多张小图片,这意味着浏览器要逐个下载50张图片.Css Sprite它 ...

  4. 21-2-substring

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  5. redis通过命令传参以及主从复制

    config set appendonly  yes  临时生效 如果想永久生效的话,执行 config rewrite 并不是所有的都支持修改 config set bind ip  修改bind参 ...

  6. PHP算法之IP 地址无效化

    给你一个有效的 IPv4 地址 address,返回这个 IP 地址的无效化版本. 所谓无效化 IP 地址,其实就是用 "[.]" 代替了每个 ".". 示例 ...

  7. dubbo重连机制会不会造成错误

    dubbo在调用服务不成功时,默认会重试2次. Dubbo的路由机制,会把超时的请求路由到其他机器上,而不是本机尝试,所以 dubbo的重试机器也能一定程度的保证服务的质量. 但是如果不合理的配置重试 ...

  8. delphi 第3课

    (1)主程序:汇总或者记载 Delphi应用程序是以窗体为中心的 (1) 1 (2) 控制语句 if 条件 then 语句1: else 语句2: 2018-04-22   21:47:17

  9. Unable to resolve dependency for ':app@debug/compileClasspath': Could not resolve com.android.support:appcompat-v7:26.1.0

    android studio  3.0 出现此问题可能是因为 你的android studio 时脱机状态 无法下载资源 这时候你可以点击左上角分File->Other Settings-> ...

  10. requestAnimationFrame动画封装

    function Animator(duration, progress) { this.duration = duration; this.progress = progress; this.nex ...