'How to select entities by calling a stored procedure with Spring Data

Let's say I have a MySQL stored procedure that contains the following select:

select * from users;

How to use the @Procedure annotation in a JpaRepository so that I can get the results? Something like:

public UserRepository extenda JpaRepository<User, Long>{
    @Procedure('get_users')
    List<User> getUsers();
}


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source