diff --git a/src/main/kotlin/org/springframework/data/repository/CrudRepositoryExtensions.kt b/src/main/kotlin/org/springframework/data/repository/CrudRepositoryExtensions.kt index 44c67742a..94b39220d 100644 --- a/src/main/kotlin/org/springframework/data/repository/CrudRepositoryExtensions.kt +++ b/src/main/kotlin/org/springframework/data/repository/CrudRepositoryExtensions.kt @@ -19,8 +19,9 @@ package org.springframework.data.repository * Retrieves an entity by its id. * * @param id the entity id. - * @return the entity with the given id or `null` if none found + * @return the entity with the given id or `null` if none found. * @author Sebastien Deleuze + * @author Oscar Hernandez * @since 2.1.4 */ -fun CrudRepository.findByIdOrNull(id: ID): T? = findById(id!!).orElse(null) +fun CrudRepository.findByIdOrNull(id: ID): T? = findById(id).orElse(null)