Skip to content

Commit 6f247cf

Browse files
authored
Update README-English.md
1 parent 3be7b84 commit 6f247cf

File tree

1 file changed

+82
-34
lines changed

1 file changed

+82
-34
lines changed

APIJSON-Java-Server/README-English.md

Lines changed: 82 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,54 @@
1+
## <h2 id="2">2.Server-side deployment<h2/>
2+
13
### JDBC Demo:
2-
APIJSONDemo is a simple demo for testing with APIJSON + SpringBoot, configure database in DemoSQLConfig; <br />
3-
APIJSONBoot is a complex demo for production with APIJSON + SpringBoot, configure database in DemoSQLConfig; <br />
4-
APIJSONFinal is a complex demo for production with APIJSON + SpringBoot, configure database in DemoSQLConfig. <br />
4+
[APIJSONDemo](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONDemo) is a simple demo for testing with APIJSON + SpringBoot, configure database in DemoSQLConfig; <br />
5+
[APIJSONBoot](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONBoot) is a complex demo for production with APIJSON + SpringBoot, configure database in DemoSQLConfig; <br />
6+
[APIJSONFinal](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONFinal) is a complex demo for production with APIJSON + SpringBoot, configure database in DemoSQLConfig. <br />
57

68
### Connection Pool Demo:
7-
APIJSONDemo-Druid is a simple demo for testing with APIJSON + SpringBoot + Druid, configure database in application.yml; <br />
8-
APIJSONDemo-HikariCP is a simple demo for testing with APIJSON + SpringBoot + HikariCP, configure database in application.yml; <br />
9-
APIJSONBoot-MultiDataSource is a complex demo for production with multi data sources, configure database in application.yml, <br />
10-
and the APIAuto source code is in src/main/resources/static, you can test APIs after open http://localhost:8080 with a browser.
9+
[APIJSONDemo-Druid](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONDemo-Druid) is a simple demo for testing with APIJSON + SpringBoot + Druid, configure database in application.yml; <br />
10+
[APIJSONDemo-HikariCP](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONDemo-HikariCP) is a simple demo for testing with APIJSON + SpringBoot + HikariCP, configure database in application.yml; <br />
11+
[APIJSONBoot-MultiDataSource](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource) is a complex demo for production with multi data sources, configure database in application.yml, <br />
12+
and the [APIAuto](https://github.com/TommyLemon/APIAuto) source code is in [src/main/resources/static](https://github.com/APIJSON/APIJSON-Demo/tree/master/APIJSON-Java-Server/APIJSONBoot-MultiDataSource/src/main/resources/static), you can test APIs after open http://localhost:8080 with a browser. <br />
1113

12-
## <h2 id="2">2.Server-side deployment<h2/>
13-
14-
You can use either Eclipse for JavaEE or IntelllJ IDEA Ultimate to make installation. For both, first download the project and save it to a path.
14+
<br />
15+
16+
**You can use either Eclipse for JavaEE or IntelllJ IDEA Ultimate to make installation. <br />
17+
For both, first [download the project](https://github.com/APIJSON/APIJSON-Demo/archive/master.zip) and save it to a path.** <br />
1518

16-
### <h3 id="2.1">2.1 Installing with Eclipse<h3/>
19+
<br />
20+
21+
### <h3 id="2.1">2.1 Requirements<h3/>
22+
JDK(Java Development Kit): 1.8+ <br />
23+
[Maven](https://maven.apache.org/download.cgi): 3.0+ <br />
24+
Database: MySQL/PostgreSQL/Oracle/DB2/SQLServer/TiDB/ClickHouse/TDengine .. <br />
1725

18-
#### <h4 id="2.1.1">2.1.1 prerequisites<h4/>
19-
20-
Java Development Kit(JDK): 1.8 or above
21-
[MAVEN](https://maven.apache.org/download.cgi): 3.0 or above
22-
Mysql / Oracle
23-
[Eclipse Java EE IDE](https://www.eclipse.org/downloads/)for Web Developers.Version: Mars.1 Release (4.5.1)
26+
<br />
27+
28+
### <h3 id="2.2">2.2 Import MySQL table files<h3/>
29+
30+
This Server project needs [MySQL Server](https://dev.mysql.com/downloads/mysql/) and [MySQLWorkbench](https://www.mysql.com/products/workbench/). Please make sure that both of them are installed.<br />
31+
32+
My config is Windows 7 + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.7 and OSX EI Capitan + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.8. Systems and softwares are all 64 bit.
33+
34+
Start *MySQLWorkbench > Enter a connection > Click Server menu > Data Import > Select the path of your .sql file > Start Import > Refresh SCHEMAS*. Now you should see tables are added successfully.
35+
36+
<br />
37+
38+
### <h3 id="2.3">2.3 Installing with Eclipse<h3/>
2439

25-
#### <h4 id="2.1.2">2.1.2 Opening the project with Eclipse<h4/>
40+
#### <h4 id="2.3.1">2.3.1 prerequisites<h4/>
41+
[Eclipse Java EE IDE](https://www.eclipse.org/downloads/) for Web Developers 4.5.1+
42+
43+
#### <h4 id="2.3.2">2.3.2 Opening the project with Eclipse<h4/>
2644

2745
Open Eclipse> *File > Import > Maven > Existing Maven Projects > Next > Browse > Select the path of the project you saved / APIJSON-Java-Server / APIJSONBoot > check pom.xml...apijson-demo > Finish*
2846

29-
#### <h4 id="2.1.3">2.1.3 Preparing the library used in demo<h4/>
47+
#### <h4 id="2.3.3">2.3.3 Preparing the library used in demo<h4/>
3048

31-
In the menu at the right, click libs, right click apijson-orm.jar,click add as library. Apply the same to the rest *.jar* files in libs.
49+
In the menu at the right, click libs, right click apijson-orm.jar, click add as library. Apply the same to the rest *.jar* files in libs.
3250

33-
#### <h4 id="2.1.4">2.1.4 Configuration<h4/>
51+
#### <h4 id="2.3.4">2.3.4 Configuration<h4/>
3452

3553
Open apijson.demo.server.DemoSQLConfig. In line 40-61, change return values of `getDBUri`,`getDBAccount`,`getDBPassword`,`getSchema` to your own database.<br/>
3654

@@ -68,33 +86,63 @@ Open apijson.demo.server.DemoSQLConfig. In line 40-61, change return values of `
6886

6987
**Note**: Instead of this step, you can also [import your database](#2.2).
7088

71-
#### <h4 id="2.1.5">2.1.5 Running the application<h4/>
89+
#### <h4 id="2.3.5">2.3.5 Running the application<h4/>
7290

7391
In Eclipse, in the menu on the top, click *Run>Run As>Java Application>choose APIJSONApplication>OK*
7492

75-
### <h3 id="2.2">2.2 Import MySQL table files<h3/>
76-
77-
This Server project needs [MySQL Server](https://dev.mysql.com/downloads/mysql/) and [MySQLWorkbench](https://www.mysql.com/products/workbench/). Please make sure that both of them are installed.<br />
78-
79-
My config is Windows 7 + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.7 and OSX EI Capitan + MySQL Community Server 5.7.16 + MySQLWorkbench 6.3.8. Systems and softwares are all 64 bit.
80-
81-
Start *MySQLWorkbench > Enter a connection > Click Server menu > Data Import > Select the path of your .sql file > Start Import > Refresh SCHEMAS*. Now you should see tables are added successfully.
82-
83-
### <h3 id="2.3">2.3 Installing with IntellIJ IDEA Ultimate<h3/>
93+
94+
### <h3 id="2.4">2.4 Installing with IntellIJ IDEA Ultimate<h3/>
8495

85-
#### <h4 id="2.3.1">2.3.1 Opening the project<h4/>
96+
#### <h4 id="2.4.1">2.4.1 Opening the project<h4/>
8697

8798
*Open > Select the path of the project/APIJSON-Java-Server/APIJSONBoot > OK*
8899

89-
#### <h4 id="2.3.2">2.3.2 Preparing the library used in demo<h4/>
100+
#### <h4 id="2.4.2">2.4.2 Preparing the library used in demo<h4/>
90101

91102
In libs, right-click *apijson-orm.jar >Add as Library>OK*. Apply this to all *.jar* files in libs.
92103

93-
#### <h4 id="2.3.3">2.3.3 Running the application<h4/>
104+
#### <h4 id="2.4.3">2.4.3 Configuration<h4/>
105+
106+
Open apijson.demo.server.DemoSQLConfig. In line 40-61, change return values of `getDBUri`,`getDBAccount`,`getDBPassword`,`getSchema` to your own database.<br/>
107+
108+
```java
109+
static {
110+
DEFAULT_DATABASE = DATABASE_MYSQL; // TODO
111+
DEFAULT_SCHEMA = "sys"; // TODO defaults: MySQL: sys, PostgreSQL: public, SQL Server: dbo, Oracle:
112+
}
113+
114+
@Override
115+
public String getDBVersion() {
116+
return "5.7.22"; // "8.0.11"; // TODO
117+
}
118+
119+
@JSONField(serialize = false)
120+
@Override
121+
public String getDBUri() {
122+
// add userSSL=false for MySQL 8.0+ return "jdbc:mysql://localhost:3306?userSSL=false&serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8";
123+
// for MySQL not greater than 5.7
124+
return "jdbc:mysql://localhost:3306?serverTimezone=GMT%2B8&useUnicode=true&characterEncoding=UTF-8"; // TODO TiDB can be used as MySQL, its defaut port is 4000
125+
}
126+
127+
@JSONField(serialize = false)
128+
@Override
129+
public String getDBAccount() {
130+
return "root"; // TODO
131+
}
132+
133+
@JSONField(serialize = false)
134+
@Override
135+
public String getDBPassword() {
136+
return "apijson"; // TODO TiDB can be used as MySQL, its defaut password is an empty string ""
137+
}
138+
```
139+
#### <h4 id="2.4.4">2.4.4 Running the application<h4/>
94140

95141
In the menu on the top: *Run > Run > Edit Configurations > + > Application > Configuration*<br />
96142
In *Main class* , choose *APIJSONApplication*;<br />
97143
In *Use classpath of module* , choose *apijson-demo*.<br />
98144
Click *Run* in the bottom.
99145

146+
<br /><br />
147+
100148
**Note**: After running, you should see APIJSON test logs and in the last, it would show ‘APIJSON已启动’. If it shows ‘address already in use’, that means port 8080 has been used . You need tochange the port. See [how to change ports for a Spring Boot Application.](https://stackoverflow.com/questions/21083170/how-to-configure-port-for-a-spring-boot-application)

0 commit comments

Comments
 (0)