@@ -21,16 +21,12 @@ public class ApplicationRestController {
2121 @ Autowired
2222 private ApplicationContext applicationContext ;
2323
24- private final String links =
25- "<a href=\" /send-handled-exception\" >Send a handled exception to Bugsnag</a><br/>"
26- + "<a href=\" /send-handled-exception-info\" >Send a handled exception to Bugsnag with INFO severity</a><br/>"
27- + "<a href=\" /send-handled-exception-with-metadata\" >Send a handled exception to Bugsnag with custom MetaData</a><br/>"
28- + "<a href=\" /send-unhandled-exception\" >Send an unhandled exception to Bugsnag</a><br/>"
29- + "<a href=\" /shutdown\" >Shutdown the application</a><br/>" ;
24+ @ Autowired
25+ private String exampleWebsiteLinks ;
3026
3127 @ RequestMapping ("/" )
3228 public String index () {
33- return links ;
29+ return exampleWebsiteLinks ;
3430 }
3531
3632 @ RequestMapping ("/send-handled-exception" )
@@ -42,7 +38,7 @@ public String sendHandledException() {
4238 bugsnag .notify (e );
4339 }
4440
45- return links + "<br/>Sent a handled exception to Bugsnag" ;
41+ return exampleWebsiteLinks + "<br/>Sent a handled exception to Bugsnag" ;
4642 }
4743
4844 @ RequestMapping ("/send-handled-exception-info" )
@@ -54,7 +50,7 @@ public String sendHandledExceptionInfo() {
5450 bugsnag .notify (e , Severity .INFO );
5551 }
5652
57- return links + "<br/>Sent a handled exception to Bugsnag with INFO severity" ;
53+ return exampleWebsiteLinks + "<br/>Sent a handled exception to Bugsnag with INFO severity" ;
5854 }
5955
6056 @ RequestMapping ("/send-handled-exception-with-metadata" )
@@ -70,7 +66,7 @@ public String sendHandledExceptionWithMetadata() {
7066 });
7167 }
7268
73- return links + "<br/>Sent a handled exception to Bugsnag with custom MetaData" ;
69+ return exampleWebsiteLinks + "<br/>Sent a handled exception to Bugsnag with custom MetaData" ;
7470 }
7571
7672 @ RequestMapping ("/send-unhandled-exception" )
@@ -90,11 +86,17 @@ public void run() {
9086 // Wait for unhandled exception thread to finish
9187 thread .join ();
9288
93- return links + "<br/>Sent an unhandled exception to Bugsnag" ;
89+ return exampleWebsiteLinks + "<br/>Sent an unhandled exception to Bugsnag" ;
90+ }
91+
92+ @ RequestMapping ("/send-spring-handled-exception" )
93+ public String sendSpringHandledException () {
94+ LOGGER .info ("Sending a Spring handled exception to Bugsnag" );
95+ throw new RuntimeException ("Spring handled exception" );
9496 }
9597
9698 @ RequestMapping ("/shutdown" )
97- public void shutdown () throws InterruptedException {
99+ public void shutdown () {
98100 LOGGER .info ("Shutting down application" );
99101
100102 SpringApplication .exit (applicationContext );
0 commit comments