ch07/tacos/src/main/java/tacos/TacoCloudApplication.java
// To avoid 404s when using Angular HTML 5 routing
To avoid 404s when using Angular HTML 5 routing
To avoid 404s when using Angular HTML 5 routing
@Bean
  ErrorViewResolver supportPathBasedLocationStrategyWithoutHashes() {
      return new ErrorViewResolver() {
          @Override
          public ModelAndView resolveErrorView(HttpServletRequest request, HttpStatus status, Map<String, Object> model) {
              return status == HttpStatus.NOT_FOUND
                      ? new ModelAndView("index.html", Collections.<String, Object>emptyMap(), HttpStatus.OK)
                      : null;
          }
      };
  }
@ Bean ErrorViewResolver supportPathBasedLocationStrategyWithoutHashes ( ) { return new ErrorViewResolver ( ) { @ Override public ModelAndView resolveErrorView ( HttpServletRequest request , HttpStatus status , Map < String , Object > model ) { return status == HttpStatus . NOT_FOUND ? new ModelAndView ( "index.html" , Collections . < String , Object > emptyMap ( ) , HttpStatus . OK ) : null ; } } ; }
To avoid 404s when using Angular HTML 5 routing
To avoid 404s when using Angular HTML 5 routing