Trigger 404 in Spring-MVC controller?

后端 未结 14 1328
攒了一身酷
攒了一身酷 2020-11-29 14:59

How do I get a Spring 3.0 controller to trigger a 404?

I have a controller with @RequestMapping(value = \"/**\", method = RequestMethod.GET) and for som

14条回答
  •  时光取名叫无心
    2020-11-29 15:38

    This is a bit late, but if you are using Spring Data REST then there is already org.springframework.data.rest.webmvc.ResourceNotFoundException It also uses @ResponseStatus annotation. There is no need to create a custom runtime exception anymore.

提交回复
热议问题