Source:
public Object resolveArgument(final MethodParameter parameter, final ModelAndViewContainer modelAndViewContainer, final NativeWebRequest nativeWebRequest, final WebDataBinderFactory webDataBinderFactory) throws MissingPathVariableException { final RepositoryMapping repositoryMapping = parameter.getParameterAnnotation(RepositoryMapping.class); final String storageVariableName = repositoryMapping.storageVariableName(); final String storageId = getRequiredPathVariable(parameter, nativeWebRequest, storageVariableName); final String repositoryVariableName = repositoryMapping.repositoryVariableName(); final String repositoryId = getRequiredPathVariable(parameter, nativeWebRequest, repositoryVariableName); Repository repository = (Repository) nativeWebRequest.getAttribute(REPOSITORY_REQUEST_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); if (repository != null && Objects.equals(repository.getId(), repositoryId) && Objects.equals(repository.getStorage().getId(), storageId)) { return repository; } final Storage storage = getStorage(storageId); if (storage == null) { final String message = String.format(NOT_FOUND_STORAGE_MESSAGE, storageId); throw new StorageNotFoundException(message); } repository = getRepository(storageId, repositoryId); if (repository == null) { final String message = String.format(NOT_FOUND_REPOSITORY_MESSAGE, storageId, repositoryId); throw new RepositoryNotFoundException(message); } final boolean inService = repositoryMapping.inServiceRepository(); if (!inService) { final String message = String.format(NOT_IN_SERVICE_REPOSITORY_MESSAGE, storageId, repositoryId); throw new ServiceUnavailableException(message); } return repository; }

Target:
public Object resolveArgument(final MethodParameter parameter, final ModelAndViewContainer modelAndViewContainer, final NativeWebRequest nativeWebRequest, final WebDataBinderFactory webDataBinderFactory) throws MissingPathVariableException { final RepositoryMapping repositoryMapping = parameter.getParameterAnnotation(RepositoryMapping.class); final String storageVariableName = repositoryMapping.storageVariableName(); final String storageId = getRequiredPathVariable(parameter, nativeWebRequest, storageVariableName); final String repositoryVariableName = repositoryMapping.repositoryVariableName(); final String repositoryId = getRequiredPathVariable(parameter, nativeWebRequest, repositoryVariableName); Repository repository = (Repository) nativeWebRequest.getAttribute(REPOSITORY_REQUEST_ATTRIBUTE, RequestAttributes.SCOPE_REQUEST); if (repository != null && Objects.equals(repository.getId(), repositoryId) && Objects.equals(repository.getStorage().getId(), storageId)) { return repository; } final Storage storage = getStorage(storageId); if (storage == null) { final String message = String.format(NOT_FOUND_STORAGE_MESSAGE, storageId); throw new StorageNotFoundException(message); } repository = getRepository(storageId, repositoryId); if (repository == null) { final String message = String.format(NOT_FOUND_REPOSITORY_MESSAGE, storageId, repositoryId); throw new RepositoryNotFoundException(message); } if (!repository.isInService() && !repositoryMapping.allowOutOfServiceRepository()) { final String message = String.format(NOT_IN_SERVICE_REPOSITORY_MESSAGE, storageId, repositoryId); throw new ServiceUnavailableException(message); } return repository; }