APIJSON/APIJSON-Java-Server at master · force0908/APIJSON
Repository navigation
APIJSON-Java-Server
Directory actions
More options
Directory actions
More options
Latest commit
History
History
View commit history for this file.
APIJSON-Java-Server
Folders and files
| Name | Name | Last commit message | Last commit date |
|---|---|---|---|
parent directory.. | |||
| APIJSONDemo | APIJSONDemo | ||
| APIJSONLibrary | APIJSONLibrary | ||
| README.md | README.md | ||
README.md
APIJSON后端部署 - Java
1.下载后解压APIJSON工程
打开APIJSON的GitHub主页 > Clone or download > Download ZIP > 解压到一个路径并记住这个路径。
2.用Eclipse for JavaEE或IntellIJ IDEA Ultimate运行后端工程
如果以上编辑器一个都没安装,运行前先下载安装一个。
我的配置是Windows 7 + JDK 1.7.0_71 + Eclipse 4.6.1 + IntellIJ 2016.3 和 OSX EI Capitan + JDK 1.8.0_91 + Eclipse 4.6.1 + IntellIJ 2016.2.5
Eclipse for JavaEE
1)打开
顶部菜单File > Import > Maven > Existing Maven Projects > Next > Browse> 选择刚才解压路径下的APIJSON-Master/APIJSON-Java-Server/APIJSONDemo
> 勾选 /pom.xml ... apijson-demo > Finish
2)Demo依赖Library
右键libs里面的 apijson-server.jar > Build Path > Add to Build Path3)配置(如果完成下方步骤4,导入APIJSON的表,则可跳过)
打开 apijson.demo.server.DemoSQLConfig 类,编辑 getDBUri,getDBAccount,getDBPassword,getSchema 的返回值为你自己数据库的配置。4)运行
顶部菜单Run > Run As > Java Application > 选择APIJSONApplication > OKIntellIJ IDEA Ultimate
1)打开
Open > 选择刚才解压路径下的APIJSON-Master/APIJSON-Java-Server/APIJSONDemo > OK2)Demo依赖Library
右键libs里面的 apijson-server.jar > Add as Library > OK3)配置(如果完成下方步骤4,导入APIJSON的表,则可跳过)
打开 apijson.demo.server.DemoSQLConfig 类,编辑 getDBUri,getDBAccount,getDBPassword,getSchema 的返回值为你自己数据库的配置。4)运行
顶部菜单Run > Run > Edit Configurations > + > Application > Configuration> Main class 选APIJSONApplication
> Use classpath of module 选apijson-demo
> 最后在底部 Run
运行后会出现 APIJSON的测试日志,最后显示 "APIJSON已启动" ,说明已启动完成。
如果是Address already in use,说明8080端口被占用,
可以关闭占用这个端口的程序(可能就是已运行的APIJSON工程)
或者 改下APIJSON工程的端口号,参考SpringBoot改端口 。
其它问题请谷歌或百度。
3.测试连接
在浏览器输入 http://localhost:8080/get/{}
如果出现
{
"code": 200,
"msg": "success"
}
则说明已连接上。
如果是404 Not Found,请把防火墙关闭,以便外网能够访问你的电脑或服务器。
其它问题请谷歌或百度。
4.导入表文件到数据库
可以先跳过,用Table, Column或者其它 你自己数据库中已有的表 来测试。
后端需要MySQL Server和MySQLWorkbench,没有安装的都先下载安装一个。
我的配置是Windows 7 + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.7 和 OSX EI Capitan + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.8,其中系统和软件都是64位的。
启动MySQLWorkbench > 进入一个Connection > 点击Server菜单 > Data Import > 选择刚才解压路径下的APIJSON-Master/table > Start Import > 刷新SCHEMAS, 左下方sys/tables会出现添加的table。
配置你自己的表请参考: 3步创建APIJSON后端新表及配置
5.测试接口
直接使用 APIJSON在线工具 或 下载主页提供的 客户端App 。