version接口
2015-12-22 17:47
267 查看
发包时候一般需要验证是否正确版本
通过脚本在classes目录下生成一个version.txt文件
并在程序中提供version接口
通过脚本在classes目录下生成一个version.txt文件
并在程序中提供version接口
import java.io.IOException; import java.util.List; import org.apache.commons.io.IOUtils; import org.springframework.core.io.ClassPathResource; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.RestController; import com.arcsoft.web.openapi.common.basic.BaseController; @RestController @RequestMapping("/rest/service/version") public class VersionController extends BaseController{ @RequestMapping(value = "/versionInfo", method = RequestMethod.GET) @ResponseBody public Object versionInfo() throws Exception{ ClassPathResource res = new ClassPathResource("version.txt"); String ret = "unknown, version.txt does not exist!!!"; if(res.exists()){ List<String> retList = null; try{ retList = IOUtils.readLines(res.getInputStream()); ret = retList.get(0); }catch(IOException e){ e.printStackTrace(); } } return ret; } }
相关文章推荐
- android中坐标系详解
- 第六部分: 大数据监管和信息单一视图监管
- [转]Kerberos协议
- 获取手机所有联系人及搜索
- iPhone/iOS开启个人热点的相关位置调整小结
- 实现按钮拖动到底部,与底部按钮互换的功能
- Spark调度系列-----5.Spark task和Stage的跳过执行(ui显示task和stage skipped)
- SSL与TLS的区别以及介绍
- 总结一下打字
- (工具准备)Vim
- android-async-http
- iOS 播放视频时隐藏屏幕上方的状态栏
- 杭电ACM1312(dfs)
- 标签页,程序开始导航
- Shell集合运算
- c++学习日记2015.12.22
- Objective-C:Foundation框架-概述
- 62.在Android Studio中使用Git进行版本管理
- Objective-C文件和目录操作,IOS文件操作,NSFileManager使用文件操作
- 查询某一段时间内的所有天或月