Spring boot Spring Boot应用程序,JPA,

Spring boot Spring Boot应用程序,JPA,,spring-boot,rest,jpa,http-status-code-404,tomcat9,Spring Boot,Rest,Jpa,Http Status Code 404,Tomcat9,我使用spring引导框架创建了一个小应用程序。我创建了一个Rest控件类。 并将其部署到tomcat上,但我得到了404错误,即 源服务器找不到目标资源的当前表示形式,或者不愿意透露存在该表示形式 @RestController @请求映射(“学生”) 公共班级学生控制员{ @Autowired StudentRepository repository; @GetMapping public List<Student> getAllStudents() { return

我使用spring引导框架创建了一个小应用程序。我创建了一个Rest控件类。 并将其部署到tomcat上,但我得到了404错误,即 源服务器找不到目标资源的当前表示形式,或者不愿意透露存在该表示形式

@RestController
@请求映射(“学生”) 公共班级学生控制员{

@Autowired
StudentRepository repository;

@GetMapping
public List<Student> getAllStudents() {
    return (List<Student>) repository.findAll();
}

@PostMapping
public String createStudent() {
    return "created";
}

@PutMapping
public String updateStudent() {
    return "updated";
}

@DeleteMapping
public String deleteStudent() {
    return "deleted";
}
@Autowired
研究存储库;
@GetMapping
公共列表getAllStudents(){
return(List)repository.findAll();
}
@邮戳
公共字符串createStudent(){
返回“已创建”;
}
@PutMapping
公共字符串updateStudent(){
返回“更新”;
}
@删除映射
公共字符串deleteStustudent(){
返回“已删除”;
}

}

注释中缺少斜杠,应如下所示

@RestController
@RequestMapping("/students")
public class StudentController {
   ...
}