'How can I get a value from entity as String

Is it possible to get a value from an entity with the field name as String?

For example:

public class User{
    private String lastname;
    private String firstname;
}

And I have the String lastname.

How can I get the lastname?

repo.findby...?

Thanks



Sources

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

Source: Stack Overflow

Solution Source