added CrashController to showcase behaviour when exception occurs

This commit is contained in:
Mic 2013-02-05 09:49:33 +08:00
parent 2df7267a48
commit ae9085de62
2 changed files with 25 additions and 1 deletions

View file

@ -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...");
}
}

View file

@ -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)