或者,即使使用ModelAndView,也可以在同一个控制器中处理我的API调用吗?我的控制器如下所示: @RestControllerpublic class DishController {
return new ModelAndView("redirect:/d/{dish.id}", "dish.id"
我一直试图设置一个Spring控制器,但是当我试图发出一个GET请求时,我得到了一个404错误。我在这里创建了一个测试示例:WARNING: No mapping found for HTTP requestwith URI [/zk-spring-mvc-test/api/v0/foo] in DispatcherServlet with name 'dispatcher-a
似乎是这样,Spring Tool Suite 3.8.3在创建request映射视图时忽略了较新的MVC映射注释@GetMapping、@PostMapping等。如果@RestController注解的类仅使用@RequestMapping,则所有处理程序方法都会显示在Spring Tools => Show RequestMappings和Spring Explorer但是,如果只有@RestController注解的类使
org.springframework.stereotype.Controller;import org.springframework.web.bind.annotation.RequestMapping;
public class FunctionController { public String我也试过