Should Spring @Repository follow JpaRepository?

Viewed 61

I want to store data in HashMap<> or ArrayList<> without database connection. Also, I want to create a class that manages data such as updating or getting data by conditions.

In this case, is it appropriate to create and use a Repository without using a JpaRepository? Or is there another way that is appropriate?

@Repository
public interface ProductRepository  {
    private List<Product> productList; // = new ArrayList<>();

    public Product getProductByid(int id) { ... };
    public boolean updateProduct() { ... };
}
1 Answers
Related