code: public static void registerRestResourceErrorMapper(AnnotationConfigApplicationContext context,
          Consumer<RestResourceErrorMapper> errorMapperConsumer) {
          JsonTransformer jsonTransformer = context.getBean(JsonTransformer.class);
  
          RestResourceErrorMapper errorMapper = new RestResourceErrorMapper(jsonTransformer);
          if (errorMapperConsumer != null) {
              errorMapperConsumer.accept(errorMapper);
          }
          errorMapper.initialize();
  
          context.getBeanFactory().registerSingleton(RestResourceErrorMapper.class.getName(), errorMapper);
      }
docs: Register a {@link RestResourceErrorMapper} with additional exception mappings at Spring and Spark. Use this method in the
  {@link com.indoqa.boot.application.StartupLifecycle#didInitializeSpring(AnnotationConfigApplicationContext)}
  phase of the application's startup lifecycle.
  
  @param context             The Spring application context.
  @param errorMapperConsumer Provide additional error information for custom application exceptions.