mirror of
https://github.com/spring-projects/spring-petclinic.git
synced 2025-05-28 06:09:37 +00:00
added CrashController to showcase behaviour when exception occurs
This commit is contained in:
parent
2df7267a48
commit
ae9085de62
2 changed files with 25 additions and 1 deletions
|
@ -0,0 +1,23 @@
|
|||
|
||||
package org.springframework.samples.petclinic.web;
|
||||
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
/**
|
||||
* Controller used to showcase what happens when an exception is thrown
|
||||
*
|
||||
* @author Michael Isvy
|
||||
*/
|
||||
@Controller
|
||||
public class CrashController {
|
||||
|
||||
@RequestMapping(value="/oups", method = RequestMethod.GET)
|
||||
public String triggerException() {
|
||||
throw new RuntimeException("Something went wrong...");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -66,7 +66,8 @@ public class OwnerController {
|
|||
|
||||
@RequestMapping(value = "/owners/find", method = RequestMethod.GET)
|
||||
public String initFindForm(Model model) {
|
||||
throw new RuntimeException("aaaaaaa");
|
||||
model.addAttribute("owner", new Owner());
|
||||
return "owners/findOwners";
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/owners", method = RequestMethod.GET)
|
||||
|
|
Loading…
Reference in a new issue