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

Error updating data in mysql using php
Java-Selenium- Image upload
How to use hibernate with Spring MVC properly?
first half works but second half doesn't store any value
I am trying to write a program that multiply matrix and vector using MPJ Express
Java 8: hierarchically scan for package-level annotations
Drawing a Line with MouseAdapter Not Showing Java
How to make a button open a new activity
Crash when tapping search button in action bar (Android)
Inserting an “INTO” clause to a package body
Using JedisPool with Tomcat, resources not being returned back to pool
XPATH issue. Not able to read parts of html
JUnit test suite involving file reading is performing differently on Windows 10 and Fedora 23
Best way to stream back HTTP-Response?
Slf4j/log4j: FileAppender added at runtime doesn't work
How to insert in to multiple tables using one query in MySQL?

Categories

HOME
amazon-ec2
cookies
google-play
view
session
jsp-tags
google-oauth
react-redux
jgroups
disassembler
baqend
pivotal-cloud-foundry
acquia
azure-media-services
ios-charts
gorm
spring-tool-suite
vb.net-2010
gz
jsprit
finite-automata
swiftlint
devops
android-widget
chromebook
maxmind
typo3-6.2.x
jspm
windowbuilder
contact-form
siesta-swift
winrt-xaml-toolkit
column-family
grails-3.1
atl
google-api-nodejs-client
picasso
revolution-slider
swift3.0.2
galen
grid.mvc
fakeiteasy
password-encryption
angular2-meteor
qsslsocket
forever
libusb-win32
windows-iot-core-10
webdriverjs
instant
httplistener
ado.net-entity-data-model
thrust
etsy
markojs
flash-cs5
freedesktop.org
hsv
rtbkit
feedback
ibaction
ios9.1
myo
dd
qcodo
xcode-6.2
google-reader
openexr
android-radiobutton
typeof
jboss-weld
flexmojos
aqtime
odata4j
dataadapter
rabl
sharp-repository
robotics-studio
delphi-6
hosts-file
ocx
assembly-loading
libc++
nsobject
coercion
xmlspy
xtype
appendto
actionview
jquery-ui-droppable
filtered-index
nsviewanimation
asp.net-profiles
vc90
virtual-functions
xetex
phonon
msdev
3gp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile