-
Notifications
You must be signed in to change notification settings - Fork 126
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
Auto-configure not working when using @SpringBootApplication #777
Comments
Realised that my application already had a |
I had the same issue 😖 I have to be honest, I'm still not sure if I must configure When I add the following config: @EnableAutoConfiguration(exclude = ErrorMvcAutoConfiguration.class) And there's any @ControllerAdvice
public class ResponseStatusExceptionHandler implements ResponseStatusAdviceTrait {
@Override
public ProblemBuilder prepare(Throwable throwable, StatusType status, URI type) {
ResponseStatusException exception = (ResponseStatusException) throwable;
return Problem.builder()
.withTitle(status.getReasonPhrase())
.withStatus(status)
.withDetail(exception.getReason())
;
}
} Everything stopped working. But if I disable the Could you guys give us any help? |
This PR introduces a section in the Spring MVC installation README.md regarding the situation when there is an existing ControllerAdvice. Additionally I've updated the application.properties config path which was outdated. This PR refers to an issue I've opened some time back - zalando#777
Description
The library is not initialised when using the annotation
@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)
Expected Behavior
The expected behaviour should be the default error response from the library.
Actual Behavior
The default Spring boot response is returned (empty).
Steps to Reproduce
Added library
<dependency> <groupId>org.zalando</groupId> <artifactId>problem-spring-web-starter</artifactId> <version>0.27.0</version> </dependency>
Configure Spring boot
web: resources: add-mappings: false mvc: throw-exception-if-no-handler-found: true
Used annotation
@SpringBootApplication(exclude = ErrorMvcAutoConfiguration.class)
Alternatively tried with following without success
@EnableAutoConfiguration(exclude = {ErrorMvcAutoConfiguration.class}) @Configuration @ComponentScan(basePackages = "com.foo.bar") @SpringBootConfiguration
Your Environment
The text was updated successfully, but these errors were encountered: