Spring boot can I replace ResourceHttpRequestHandler with my own implementation? -


i running this issue since have app has restful services need serve static ones too. in app use enableswagger2 annotation. looks class public , subclass not sure how configure that. goal override this line can have control on 404s.

so did , worked me. config got me bit here is. subclass resourcehttprequesthandler 1 named customresourcehandler. in application.java wired properly:

@bean public resourcehttprequesthandler resourcehttprequesthandler() {     resourcehttprequesthandler requesthandler = new customresourcehandler();     requesthandler.setlocations(arrays.<resource>aslist(applicationcontext.getresource("/")));     return requesthandler; }  @bean public simpleurlhandlermapping sampleservletmapping(){     simpleurlhandlermapping mapping = new simpleurlhandlermapping();     mapping.setorder(integer.max_value - 2);     properties urlproperties = new properties();     urlproperties.put("/**", "resourcehttprequesthandler");     mapping.setmappings(urlproperties);     return mapping; }  @autowired applicationcontext applicationcontext; 
  • this answer helped me proper config of mapper.
  • this answer context helped me locations set in handler. setting them different way wasn't working 100% resources

Comments

Popular posts from this blog

inversion of control - Autofac named registration constructor injection -

verilog - Systemverilog dynamic casting issues -

ios - Change Storyboard View using Seague -