我有一個Spring Boot
網絡應用程序,我明白我的自定義異常的ControllerAdvice
類。問題是,如果沒有處理程序被發現Spring Boot
不會拋出默認異常(發送json
回客戶端)。沒有處理髮現的異常和靜態的recources春季啓動
我想是趕上NoHandlerFoundException
我ControllerAdvice
類。要做到這一點我明確地配置
spring.mvc.throw-exception-if-no-handler-found=true
spring.resources.add-mappings=false
這招做這項工作,我能趕上NoHandlerFoundException
,但現在它禁用Spring
自動配置路徑靜態資源。所以我現在所有的靜態資源都不可用於客戶端。我試圖解決這個使用一個以上的配置不利於
spring.resources.static-locations=classpath:/resources/static/
有誰請指教如何在自動配置與spring.resources.add-mappings=false
禁用靜態資源Spring Boot
地圖?
謝謝!
您是否找到任何解決方案? –