master
Administrator 2019-08-23 20:49:31 +08:00
parent 43885b9858
commit 667fa1f73b
4 changed files with 73 additions and 5 deletions

View File

@ -0,0 +1,26 @@
package com.zz.controller;
import java.util.ArrayList;
import java.util.List;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.zz.entity.Student;
@RestController
@RequestMapping("student")
public class StudentController {
@GetMapping("showall")
public List<Student> getAll(){
List<Student> ls=new ArrayList<Student>();
Student s=new Student();
s.setName("张三");
ls.add(s);
return ls;
}
}

View File

@ -116,4 +116,6 @@ Spring Boot中包含了一些注解对应于HTTP协议中的方法
@DeleteMappingHTTPDELETE @DeleteMappingHTTPDELETE
@PatchMappingHTTPPATCH @PatchMappingHTTPPATCH
8** 8**
http://localhost:9000/swagger-ui.html
**/ **/

View File

@ -0,0 +1,43 @@
package com.zz.entity;
public class Student {
private String name;
private String subject;
private int teamId;
private int id;
private double score;
public int getTeamId() {
return teamId;
}
public void setTeamId(int teamId) {
this.teamId = teamId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public double getScore() {
return score;
}
public void setScore(double score) {
this.score = score;
}
}

View File

@ -1,5 +1,2 @@
// server.port=9085
server.port=9080 server.servlet.context-path=/s
//
// 所有路径都需要加a. http:localhost:9080/a/all
server.servlet.context-path=/a