java
Is it possible to disable Spring Boot's autoexception handling from application.properties
Is it possible to disable Spring Boot's autoexception handling from application.properties? I am trying to disable Spring Boots general exception handling without renaming error.html while coding and turn it on at production from application.properties. I've found the following from Spring documentation: At start-up, Spring Boot tries to find a mapping for /error. By convention, a URL ending in /error maps to a logical view of the same name: error. In the demo application this view maps in turn to the error.html Thymeleaf template. (If using JSP, it would map to error.jsp according to the setup of your InternalResourceViewResolver). If no mapping from /error to a View can be found, Spring Boot defines its own fall-back error page - the so-called “Whitelabel Error Page” (a minimal page with just the HTTP status information and any error details, such as the message from an uncaught exception). If you rename the error.html template to, say, error2.html then restart, you will see it being used. And also I tried the following properties which didn't work: server.error.path=/somewrongurl server.error.whitelabel.enabled=false
Add following lines into your application.properties file spring.mvc.throw-exception-if-no-handler-found=true spring.resources.add-mappings=false And define your own Exception Controller to catch all related exceptions like #ControllerAdvice public class ExceptionController { #ExceptionHandler(value = Exception.class) public ResponseEntity<?> handleException(Exception e) { //handle your exception } }
Related Links
Jersey Async ContainerRequestFilter
Adding ActionListener to button
how to dynamically set the “value” attribute of url tag in struts2?
Spring 4 binaries download
Application crashing on calling a JNI modal dialog box
Spring integration tests with profile
Bufferedreader blocks thread but adding in if(br.ready()) stops disconnect check
Remove/Find Nodes in hierarchical table of JPA Hibernate
live wallpaper, frame animation, lags
DB2 installation error while installing portlet server
Generate different sequence Ids per child entity table - Java/Hibernate
gettting nullpointerexception while adding resources in arquillian
Hibernate Lazy Load and #Transient
import large data into a 2d array
BeanCreationException in spring controller
How to tag field specific nouns using Parts-of-Speech Taggers?