File tree Expand file tree Collapse file tree 1 file changed +28
-0
lines changed
src/main/java/com/nfnote/controller Expand file tree Collapse file tree 1 file changed +28
-0
lines changed Original file line number Diff line number Diff line change
1
+ package com .nfnote .controller ;
2
+
3
+ import org .springframework .beans .factory .annotation .Value ;
4
+ import org .springframework .boot .web .servlet .error .ErrorController ;
5
+ import org .springframework .http .MediaType ;
6
+ import org .springframework .stereotype .Controller ;
7
+ import org .springframework .web .bind .annotation .RequestMapping ;
8
+
9
+ /**
10
+ * Created by codedrinker on 2020/08/16.
11
+ */
12
+ @ Controller
13
+ @ RequestMapping ("${server.error.path:${error.path:/error}}" )
14
+ public class CustomizeErrorController implements ErrorController {
15
+
16
+ @ Value ("${domain}" )
17
+ private String domain ;
18
+
19
+ @ Override
20
+ public String getErrorPath () {
21
+ return "error" ;
22
+ }
23
+
24
+ @ RequestMapping (produces = MediaType .TEXT_HTML_VALUE )
25
+ public String errorRedirect () {
26
+ return "redirect:" + domain ;
27
+ }
28
+ }
You can’t perform that action at this time.
0 commit comments