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

Eclipse running old programs, no main method
Data is not ordered correctly with pagination: Sql server and Hibernate 3.6.10
I want another class like main activity to receive data from bluetooth, am unable to switch to another activity
How to make a Repeating Alarm for API 23 , 19 And less
Calling a method in the while loop condition
Sikuli Jar is throwing error in remote machine while using ssh /Jenkins Asked
Compare String to a Regex
Java: remove a range of indices from a list
How to write XML code for width and heigh in Java
Java: properly closing sockets for multi threaded servers
JAX-RS (RestEasy) middleware: brokering client request
Adding Jsoup Jar to MapReduce
LibGDX: Drawing 50x50 tiles is very slow
Broadcast receiver register in on create of class extend from application
Selenium WebDriver tests sometimes doesn't find elements
builder pattern json deserialize

Categories

HOME
pandas
xamarin
smarty
onedrive
lodash
kalman-filter
spring-cloud-stream
packages
binary-tree
ebean
mvvmcross
constraint-programming
qore
dax
visual-studio-2005
ibm-odm
dynamics-crm-online
netflix
saxon
finite-automata
reactive-cocoa
jndi
crosstab
angular2-aot
social-media
ejabberd-module
file-rename
newline
flink-streaming
data-manipulation
android-ble
swisscomdev
jna
document.write
greenrobot-eventbus
trim
email-templates
nxlog
midl
s
taffy
dds
rails-routing
aurelia-validation
lowpass-filter
jxcore
libusb-win32
akka-cluster
mcafee
google-cdn
static-ip-address
vmware-tools
home-directory
database-optimization
multi-level
thrust
paypal-express
moveit
fadeout
livequery
photobucket
hsv
wso2cloud
kcachegrind
rgeo
riak-cs
ibaction
mono-embedding
sailfish-os
operation
sonarqube5.1.2
proj4js
operator-precedence
has-many-through
sgen
centos5
oam
ember-app-kit
robotics-studio
trusted
javaspaces
getmessage
dotnethighcharts
assembly-loading
stage
spyware
xmlspy
xtype
ecl
yslow
database-management
pascal-fc
putchar
genealogy

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile