The purpose of declaring the List<Product> findByName(String name) method in the ProductRepository interface is to provide a higher-level abstraction for querying the Product entities by name.
Even if you didn't explicitly declare this method, you would still be able to access methods inherited from the CouchbaseRepository interface, such as findAll(), findById(), etc., to interact with the Product entities in the Couchbase database.
However, by declaring the findByName method in the ProductRepository, you are adding a custom method specific to your application's requirements. This allows you to perform a filtered search for Product entities based on their name.
For example, if you have a scenario where you need to retrieve all products that match a specific name, you can use the findByName method directly on the ProductRepository without manually constructing the query or filtering the results afterwards.
Adding custom methods like findByName provides a more expressive and convenient way to work with specific queries tailored to your domain, rather than relying solely on the generic methods inherited from the CouchbaseRepository.