我的问题与春季的http post方法有关,它以不同的方式工作[关闭]

问题描述 投票:0回答:1
my problem

my code lines

我正在使用Spring Boot构建一个Web应用程序,它将仅执行CRUD操作。

package com.shamsi.location.controllers; import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.shamsi.location.entities.Location; import com.shamsi.location.repos.LocationRepositoy; @RestController @RequestMapping("/locations") public class locationRestController { @Autowired LocationRepositoy locationRepository; @GetMapping public List<Location> getLoctions(){ return locationRepository.findAll(); } @PostMapping public Location createLocation (Location location) { return locationRepository.save(location); } }

java spring-boot spring-restcontroller
1个回答
0
投票
我发现了阻止我将请求发送到服务器的错误
© www.soinside.com 2019 - 2024. All rights reserved.