Skip to content

Instantly share code, notes, and snippets.

@httpmurilo
Created January 22, 2022 19:49
Show Gist options
  • Save httpmurilo/112ad35ce6ab5ddb869eacbb6bcafc73 to your computer and use it in GitHub Desktop.
Save httpmurilo/112ad35ce6ab5ddb869eacbb6bcafc73 to your computer and use it in GitHub Desktop.
CustomerRepository
package io.murilo.store.repository;
import io.murilo.store.model.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.data.rest.core.annotation.RepositoryRestResource;
import java.util.List;
import java.util.Optional;
@RepositoryRestResource(path = "customer")
public interface CustomerRepository extends JpaRepository<Customer, Integer> {
List<Customer> findByName(@Param("name") String name);
Optional<Customer> findById(Integer id);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment