java - How to disable ErrorPageFilter in spring-boot? -
i'm creating soap
service should running on tomcat. i'm using spring-boot
application, similar to:
@configuration @enableautoconfiguration(exclude = errormvcautoconfiguration.class) public class appconfig { }
my webservice (example):
@component @webservice public class mywebservice { @webmethod @webresult public string test() { throw new myexception(); } } @webfault public class myexception extends exception { }
problem: whenever throw exception within webservice class, following message logged on server:
errorpagefilter: cannot forward error page request [/services/mywebservice] response has been committed. result, response may have wrong status code. if application running on websphere application server may able resolve problem setting com.ibm.ws.webcontainer.invokeflushafterservice false
question: how can prevent this?
to disable errorpagefilter
in spring boot (tested 1.3.0.release), add following beans spring configuration:
@bean public errorpagefilter errorpagefilter() { return new errorpagefilter(); } @bean public filterregistrationbean disablespringbooterrorfilter(errorpagefilter filter) { filterregistrationbean filterregistrationbean = new filterregistrationbean(); filterregistrationbean.setfilter(filter); filterregistrationbean.setenabled(false); return filterregistrationbean; }
Comments
Post a Comment