So far we have seen Hibernate and Spring security with various authentication providers. In this section we will use Hibernate to retrieve users and authorities from the database.
For that we are going to implement the
UserDetailsService interface and implement a method in the interface. To begin we need to create entity classes for users and roles.
We also moved the
@preAuthorize annotation to the
UserDetailsServiceinterface and add the Bean definition to the
@preAuthorizeannotation in controller