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

Elements not going where they should in fragment XML
How to change Spring Boot health actuator result for testing?
DrJava compiler gives error for my switch function
Real-Time PostgreSQL client updates based on notification
Date and time using openweathermap api
How to change icon on jlabel when an option (Bridal Gowns ,Tuxedo ) is selected
Error de-serializing Set in JSON
How to redirect to requested page directly after login in jsp? [duplicate]
Not getting correct HTTP Response Code in Selenium WebDriver with java
Java, jdbcTemplate: Syntax to Read Into Complex Structure?
Is it possible to merge XML-Elements with SAX (coremedia CAE filter)
How to unit test a service with JMockit that has a callback in Android?
Launch4j only shows program name/icon in Taskmanager when Header is 'Console'
unable to add record in My-SQL-DB using hibernate+springboot+jpa
Detect change in Consumers of an ActiveMQ topic
Scala byte array type mismatch error

Categories

HOME
pandas
log4j
bluetooth
comparison
smarty
appx
hp-exstream
raspberry-pi
filtering
sql-server-2016
facebook-messenger-bot
spring-kafka
offline
modelica
windows-phone-7
static-libraries
hex-editors
dynamics-crm-online
clearcase-ucm
django-simple-history
django-admin
pugjs
invantive-sql
sms-gateway
immutable.js
nas
conemu
object-detection
cloudhub
sox
fish
su
react-css-modules
fifo
jaxb2
nouislider
instant-messaging
socialengine
iframe-resizer
data-manipulation
fog
noraui
calibre
phpfreechat
geopositioning
io-redirection
suricata
xcode-extension
abstract-class
angularjs-factory
user-controls
graphenedb
firebase-admin
cubic-spline
jsch
theming
promela
statsd
knockout-components
django-scheduler
background-service
messenger
dstu2-fhir
mathematica-frontend
lua-5.1
blackberry-10
goose
wapiti
jqgrid-formatter
dukescript
tableau-online
php-ci
arcanist
key-management
directoryservices
javax.mail
system.reflection
website-monitoring
c3
knuth
castle
project-planning
poller
kgdb
undefined-reference
stxxl
tidy
pushbackinputstream
clipper
referrer
anonymous-methods
dice
twrequest
amazon-appstore
removeclass
coercion
cinema-4d
recent-documents
actionview
lang
telerik-scheduler
suppress
castle-monorail
temporal-database
anti-piracy

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
Mobile App
Mobile App
Mobile App