-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathREADME.txt
64 lines (49 loc) · 1.99 KB
/
README.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
-------------------------------
cd G:\workspace\workspace_ee\SpringRestDemo
git init
git remote add origin [email protected]:louising/SpringRestDemo.git
git checkout -b dev
-------------------------------
Spring MVC Demo: build RESTful web service
Run
-------------------------------------
1) Start DB (H2 DB)
c:\>java -jar "H:/lib/java/h2-1.4.197.jar"
URL: jdbc:h2:tcp://localhost/~/H2DB-SpringRestDemo
user: sa
password: sa
2) jdbc.properties
//Config JDBC connection
3) src/main/resources/applicationContext.xml
//Config DataSource
<bean id="dataSource" ...>
//Config MyBatis scan base package
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
...
<property name="basePackage" value="com.zero.srd.dao" />
</bean>
4) SpringMVC-servlet.xml
//Config Spring component scan package
<context:component-scan base-package="com.zero.srd" />
5) src/main/webapp/WEB-INF/web.xml
Config Filter and Servlet if necessary
6) Start it in Tomcat 8.0.33
mvn package
Put the war in TOMCAT_HOME/webapps
7) Visit
POST http://localhost:8080/SpringRestDemo/dummy/addUser BODY { userId: 101, userName: "Alice"}
DELETE http://localhost:8080/SpringRestDemo/dummy/del?dummyName=Alice001 BODY { "userId": 1, "userName": "Alice" }
PUT http://localhost:8080/SpringRestDemo/dummy/upd?userId=102&userName=Alice02 BODY { "userId": 103, "userName": "Alice03" }
GET http://localhost:8080/SpringRestDemo/dummy/list
POST http://localhost:8080/SpringRestDemo/dummy/page/3/2 BODY { "userId": "1", "userName": "Alice" }
POST http://localhost:8080/SpringRestDemo/dummy/uploadDoc BODY form-data
GET http://localhost:8080/SpringRestDemo/dummy/downloadLog
GET http://localhost:8080/SpringRestDemo/dummy/sysInfo
http://localhost:8080/SpringRestDemo
http://localhost:8080/SpringRestDemo/swagger-ui.html
Dev Note
-------------------------------------
1) Dao //DummyDao.java, DummyDao.xml
2) Service //DummyServiceImpl.java
3) Controller //DummyController.java
CronJob //ScheduledJob.java