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

Tomcat 7 java.lang.NullPointerException when wrong credential entered using Active Directory authentification
How to update 2 tables using one query in JPA native query?
Running separate process from Java applet using internal class
Response time out when pinging an IP address in Java
Alignment in combined OHLC chart
Log4j2 Servlet 3.0 not logging
Refresh a Loader when data is changed - android
DataAccessException vs SQLException
Expandable list view, child on click new activity with information
Maven dependency (MySQL-Connector) not found during testing phase
flyway:clean doesnot clean multiple schema
Android Jsoup Html Parse?
With knowing just 2 points that represent opposing corners, how to determine if a point input by the user is inside the rectangle
JApplet - ClassNotFoundException
How is it specified what is the first page to show in this Spring MVC demo application?
Why portrait images from gallery are being saved to Parse as landscape?

Categories

HOME
ibm-bluemix
compiler-construction
activiti
tinymce
plone
appx
elm
v8
swagger-ui
vifm
adobe-analytics
mapserver
export-to-csv
visual-studio-cordova
flask-wtforms
percona
transformation
sms-gateway
shared-hosting
swiftlint
kryo
autoconf
sylius
wijmo
underflow
internet-explorer-9
nhapi
tooltipster
elasticsearch-net
gitignore
subdomains
bluestacks
react-chartjs
nameservers
ecto
uisplitview
titanium-mobile
usbserial
vsts-build-task
cloud-code
mapdb
bitbucket-pipelines
hockeyapp
abstract-class
ssjs
lumberjack
http-live-streaming
jvm-languages
outlook-api
checkboxlist
sencha-touch-2.3
qcombobox
skeleton-css-boilerplate
xml-documentation
winscp-net
darcs
feeds
libusb-win32
google-perftools
spring-cache
color-profile
android-textview
clang-static-analyzer
simplewebrtc
qcustomplot
rhino-servicebus
ptrace
tform
lib.web.mvc
collapse
apache-commons-fileupload
sortedlist
census
p2
geonetwork
rake-task
offloading
dd
cctv
codeigniter-routing
uitouch
p4java
rebol3
bundles
oracle-warehouse-builder
app42
intentservice
imdbpy
flexmojos
c18
oam
ms-project-server-2010
dotnetnuke-5
dataservice
html4
eventual-consistency
interface-orientation
typoscript2
rdoc
cascalog
appconkit
bigcouch
work-stealing
adk
whoosh
window-management
pydot
coredump
tomcat-valve
android-sdk-2.1
nhibernate.search
substrings
dbisam

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html