I have a custom Spring Boot starter.
@Configuration
public class MyAutoConfiguration {
private static final Logger logger = LoggerFactory.getLogger(MyAutoConfiguration.class);
@Bean
public ApiControllerAdvice apiControllerAdvice() {
logger.info("ApiControllerAdvice created...");
return new ApiControllerAdvice();
}
}
and
@RestControllerAdvice
public class ApiControllerAdvice {
@ExceptionHandler(value = Exception.class)
public ResponseEntity<ApiError> handleException(Exception exception) {
HttpStatus httpStatus = HttpStatus.INTERNAL_SERVER_ERROR;
return new ResponseEntity<>(new ApiError(httpStatus, exception.getMessage()), httpStatus);
}
@ExceptionHandler(value = NotFoundException.class)
public ResponseEntity<ApiError> handleNotFoundException(NotFoundException exception) {
HttpStatus httpStatus = HttpStatus.NOT_FOUND;
return new ResponseEntity<>(new ApiError(httpStatus, exception.getMessage()), httpStatus);
}
}
It is working fine in the application where I'm using the starter. But in that application I also added in my application.properties : spring.mvc.log-resolved-exception=false
How can I add that property via the starter ? I tried with the starter application.properties and also with @ConfigurationProperties on the MyAutoConfiguration class and apiControllerAdvice bean but nothing seems working.