O'Reilly logo

Spring Security 3.x Cookbook by Anjana Mankale

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Spring Security with Hibernate using @preAuthorize annotation

In the current demonstration we are using two different databases. The authentication manager is configured with tenant1DataSource which connects to a Derby database which holds the user and role information. Using this data source we will do that authentication and authorization.

For displaying the horrormovie list we have created another datasource in Derby which is used with the Hibernate configuration file.

In the DAOImpl class methods we are using @preAuthorize annotations.

Let's use the GlassFish application server to run the application.

Getting ready

  • Edit the application-security.xml.
  • Edit the horrormovie-servlet.xml.
  • Use the @preAuthorize annotation in DAOImpl. Spring Security authorizes ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required