Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add instructions when existing ControllerAdvice and update config path #853

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions problem-spring-web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,14 @@ class ExceptionHandling implements ProblemHandling {
}
```

Check if you already have a ControllerAdvice. In this case you might want to adjust your code to solely rely on this library, or set a `@Order(Ordered.HIGHEST_PRECEDENCE)` in your existing Advice for specific exceptions and leave the others for the library to handle.

The [`NoHandlerFoundAdviceTrait`](src/main/java/org/zalando/problem/spring/web/advice/routing/NoHandlerFoundAdviceTrait.java)
in addition also requires the following configuration:

```yaml
spring:
resources:
add-mappings: false
mvc:
throw-exception-if-no-handler-found: true
spring.web.resources.add-mappings=false
spring.mvc.throw-exception-if-no-handler-found=true
```

If you're using Spring Boot, make sure you disable the `ErrorMvcAutoConfiguration`:
Expand Down