Spring Security + Hibernate Annotation Example

发布时间:2019-03-05 02:31    发布者:locoy

字体:

  In this tutorial, previous Spring Security + Hibernate4 XML example will be reused, and convert it to a annotation-based example.

  Technologies used :

  Spring 3.2.8.RELEASE

  Spring Security 3.2.3.RELEASE

  Hibernate 4.2.11.Final

  MySQL Server 5.6

  Tomcat 7 (Servlet 3.x container)

  Quick Note :

  Create a session factory with LocalSessionFactoryBuilder

  Inject session factory into a UserDao

  Integrate UserDao into a custom UserDetailsService, to load users from the database.

  A final project directory structure.

  spring-security-hibernate-annotation-directory

  Model classes and its’ annotation-based mapping file.

  DAO classes, to load data from the database, via Hibernate.

  Uses to declare a transactional method.

  Declares and binds everything with annotations, read the comments, it should be self-explanatory.

  Uses LocalSessionFactoryBuilder to create a session factory.

  Done.

  The following video demo is for the Spring Security database login tutorial. Since this tutorial is generating the same output, so the video demo is reused.

  spring-security-hibernate-annotation1

  spring-security-hibernate-annotation2

  spring-security-hibernate-annotation3

为您推荐

热点图文

精彩推荐

今日焦点

猜你喜欢