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

Java - simple drawing application
The most efficient way to draw alot of circles java
JTable with JButton inside cell
Drag and Drop ListView Rows Disappearing Android
How condition variables work and store in memory in Java? [closed]
How to display few values on the X-axis value on JFreeChart?
Java Getting latest version of iOS Passbook - PKPass bundle as response [closed]
Liferay integration options
Representing and comparing geographic locations in Java
WebApp. Java EE. Where I should initialize my business logic?
New to Spring - when/where application context is instantiation all the beans
Decompressing and Compressing a Zip/GZip Stream in JavaScript?
Retrieving Data from MySQL With Partial Data
Input Text Design Issue for a search Box
URLClassLoader Memory Leak Java
jpa native query control entity(part 3)

Categories

HOME
testing
arduino-uno
clips
rdf
frameworks
cakephp-2.5
baqend
qore
dacpac
vault
gz
iolanguage
django-admin
finite-automata
dbext
tokenize
bootstrap-tour
claims-based-identity
angular2-aot
status
virtualdub
nhapi
msys2
google-rich-snippets
javascriptcore
iframe-resizer
noraui
textmate
mapbox-gl
sequential
jmonkeyengine
libvpx
ansible-playbook
user-controls
tasker
galen
ncalc
pdf-reactor
nomethoderror
s
auto-update
xml-documentation
python-c-api
jlink
typescript1.8
forever
worker-thread
python-cryptography
flutterwave
smart-table
medium.com
url-masking
mathematica-frontend
autorest
prettytensor
essence
testng-dataprovider
ptrace
wso2cloud
lib.web.mvc
method-parameters
mmc
dia
cdt
markers
geos
soundtouch
ril
sqlperformance
ember-app-kit
distutils
unc
chuck
word-processor
errai
parametric-equations
asyncfileupload
netdna-api
window-management
stage
html-input
dentrix
mozilla-prism
exchange-server-2003
ctp4
w3wp

Resources

Encrypt Message



code
soft
python
ios
c
html
jquery
cloud
mobile