code: private void registerCustomArgumentResolvers() {
          getBean(RequestMappingHandlerAdapter.class).ifPresent(adapter -> {
              List<HandlerMethodArgumentResolver> argumentResolvers = adapter.getArgumentResolvers();
  
              if (argumentResolvers == null) {
                  throw new IllegalStateException("No argument resolvers found in " + adapter +
                          ". It appears the handler was not initialized by the application context.");
              }
  
              // Add Sling-specific argument resolvers first
              List<HandlerMethodArgumentResolver> resolvers = new LinkedList<>();
              resolvers.add(new RequestPathInfoArgumentResolver());
              resolvers.add(new ResourceResolverArgumentResolver());
              resolvers.add(new ResourceParamArgumentResolver());
  
              // Subsequently add all existing argument resolvers (they are order-sensitive, ending with a catch-all resolver,
              // thus the custom resolvers have to go first)
              resolvers.addAll(argumentResolvers);
              adapter.setArgumentResolvers(resolvers);
          });
      }
docs: Registers the custom argument resolvers if a {@link RequestMappingHandlerAdapter}
  is present in the factory.