RepositoryEntityController extends AbstractRepositoryRestController implements ApplicationEventPublisherAware { @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.GET) public ResponseEntity<EntityModel<?>> getItemResource(RootResourceInformation resourceInformation, @BackendId Serializable id, final PersistentEntityResourceAssembler assembler, @RequestHeader HttpHeaders headers) throws HttpRequestMethodNotSupportedException { return getItemResource(resourceInformation, id).map(it -> { PersistentEntity<?, ?> entity = resourceInformation.getPersistentEntity(); return resourceStatus.getStatusAndHeaders(headers, it, entity).toResponseEntity( () -> assembler.toFullResource(it)); }).orElseThrow(() -> new ResourceNotFoundException()); } @Autowired  RepositoryEntityController(Repositories repositories, RepositoryRestConfiguration config,
			RepositoryEntityLinks entityLinks, PagedResourcesAssembler<Object> assembler,
			HttpHeadersPreparer headersPreparer); @Override void setApplicationEventPublisher(ApplicationEventPublisher publisher); @RequestMapping(value = BASE_MAPPING, method = RequestMethod.OPTIONS) ResponseEntity<?> optionsForCollectionResource(RootResourceInformation information); @RequestMapping(value = BASE_MAPPING, method = RequestMethod.HEAD) ResponseEntity<?> headCollectionResource(RootResourceInformation resourceInformation,
			DefaultedPageable pageable); @ResponseBody @RequestMapping(value = BASE_MAPPING, method = RequestMethod.GET) CollectionModel<?> getCollectionResource(@QuerydslPredicate RootResourceInformation resourceInformation,
			DefaultedPageable pageable, Sort sort, PersistentEntityResourceAssembler assembler); @ResponseBody @RequestMapping(value = BASE_MAPPING, method = RequestMethod.GET, produces = { "application/x-spring-data-compact+json", "text/uri-list" }) CollectionModel<?> getCollectionResourceCompact(@QuerydslPredicate RootResourceInformation resourceinformation,
			DefaultedPageable pageable, Sort sort, PersistentEntityResourceAssembler assembler); @ResponseBody @RequestMapping(value = BASE_MAPPING, method = RequestMethod.POST) ResponseEntity<RepresentationModel<?>> postCollectionResource(RootResourceInformation resourceInformation,
			PersistentEntityResource payload, PersistentEntityResourceAssembler assembler,
			@RequestHeader(value = ACCEPT_HEADER, required = false) String acceptHeader); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.OPTIONS) ResponseEntity<?> optionsForItemResource(RootResourceInformation information); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.HEAD) ResponseEntity<?> headForItemResource(RootResourceInformation resourceInformation, @BackendId Serializable id,
			PersistentEntityResourceAssembler assembler); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.GET) ResponseEntity<EntityModel<?>> getItemResource(RootResourceInformation resourceInformation,
			@BackendId Serializable id, final PersistentEntityResourceAssembler assembler, @RequestHeader HttpHeaders headers); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.PUT) ResponseEntity<? extends RepresentationModel<?>> putItemResource(RootResourceInformation resourceInformation,
			PersistentEntityResource payload, @BackendId Serializable id, PersistentEntityResourceAssembler assembler,
			ETag eTag, @RequestHeader(value = ACCEPT_HEADER, required = false) String acceptHeader); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.PATCH) ResponseEntity<RepresentationModel<?>> patchItemResource(RootResourceInformation resourceInformation,
			PersistentEntityResource payload, @BackendId Serializable id, PersistentEntityResourceAssembler assembler,
			ETag eTag, @RequestHeader(value = ACCEPT_HEADER, required = false) String acceptHeader); @RequestMapping(value = BASE_MAPPING + "/{id}", method = RequestMethod.DELETE) ResponseEntity<?> deleteItemResource(RootResourceInformation resourceInformation, @BackendId Serializable id,
			ETag eTag);  }
@Test public void testUnknownItemThrowsResourceNotFound() throws Exception { KeyValuePersistentEntity<?, ?> entity = mappingContext .getRequiredPersistentEntity(RepositoryPropertyReferenceControllerUnitTests.Sample.class); ResourceMappings mappings = new PersistentEntitiesResourceMappings( new PersistentEntities(Collections.singleton(mappingContext))); ResourceMetadata metadata = spy( mappings.getMetadataFor(RepositoryPropertyReferenceControllerUnitTests.Sample.class)); when(metadata.getSupportedHttpMethods()) .thenReturn(RepositoryPropertyReferenceControllerUnitTests.AllSupportedHttpMethods.INSTANCE); RootResourceInformation information = new RootResourceInformation(metadata, entity, invoker); RepositoryEntityController repositoryEntityController = new RepositoryEntityController(repositories, restConfiguration, repositoryEntityLinks, assembler, httpHeadersPreparer); assertThatExceptionOfType(ResourceNotFoundException.class) .isThrownBy(() -> repositoryEntityController.getItemResource(information, "1", null, null)); }