mirror of
https://github.com/Lemonochrme/service-architecture.git
synced 2025-06-08 21:50:50 +02:00
Added error controller
This commit is contained in:
parent
1f9ec0bf9d
commit
c183c51733
2 changed files with 23 additions and 0 deletions
|
@ -45,6 +45,12 @@
|
||||||
<artifactId>spring-boot-starter-test</artifactId>
|
<artifactId>spring-boot-starter-test</artifactId>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cxf</groupId>
|
||||||
|
<artifactId>cxf-spring-boot-starter-jaxws</artifactId>
|
||||||
|
<version>3.5.0</version>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
package insa.application.helpapp;
|
||||||
|
|
||||||
|
import org.springframework.boot.web.servlet.error.ErrorController;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
@Controller
|
||||||
|
public class CustomErrorController implements ErrorController {
|
||||||
|
|
||||||
|
@RequestMapping("/error")
|
||||||
|
@ResponseBody
|
||||||
|
public String handleError() {
|
||||||
|
// Return the inline HTML content for the custom error page
|
||||||
|
return "<html><head><title>Error</title></head><body><h1>Something went wrong!</h1><p>We are sorry, but the page you are looking for does not exist.</p><img src='https://i.ytimg.com/vi/lqvcsjvBFQA/sddefault.jpg' alt='Error Image'></body></html>";
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue