1

Related question: Spring Boot Remove Whitelabel Error Page

For my case, I disabled whitelabel by setting whitelabel.enabled = false, and I also exclude ErrorMvcAutoConfiguration. It worked in regular spring boot service. But I deployed the same service on PCF cloud foundry, then spring still want to redirect error to /error page.

Any help and suggestion is welcome.

Edit: I added exclude annotation on Application, then it works on PCF. Previously I added exclude configuration in application.yml, then it didn't work on PCF

mpromonet
  • 11,326
  • 43
  • 62
  • 91
Linden X. Quan
  • 584
  • 5
  • 18

2 Answers2

0

You need to create a separate endpoint /error and then handle it in the method. I would suggest you to maintain a separate controller infact. My code would look something like this

@RestController
@RequestMapping(path = "/error")
public class ErrorController {

    @ApiOperation(value = "Error Page", notes = "Error Page")
    @GetMapping
    public String error() {
        return "Some Error Occurred and I will Graciously show the Error"
    }
}
Arun
  • 3,440
  • 11
  • 60
  • 108
0

It turns out circuit breaker service set exclusion property first, than local application.yml didn't take effect. If I add exclusion property in repo, then it take preference.

I feel this is kind of spring bug, since exclusion is list, it should include all items, instead of taking the first configuration only.

Linden X. Quan
  • 584
  • 5
  • 18