spring security with custom user details

后端 未结 3 1446
广开言路
广开言路 2021-02-04 20:09

I am trying to apply security in my spring application using database tables.

What I have so far in my applicationContext-Security is:



        
相关标签:
3条回答
  • 2021-02-04 21:04

    All dependencies of Spring Security (such as your DAO) should be decalred in the root web application context (applicationContext.xml or other XML files configured in <context-param> named contextConfigLocation), not in serlvlet's conext (...-servlet.xml), because core Spring Security beans are declared in the root context, and beans in that context don't have access to beans in the servlet's context.

    If you use <context:component-scan>, you can follow this solution. See also:

    • Where do Spring configuration files go in a maven WAR module?
    0 讨论(0)
  • 2021-02-04 21:12

    I don't see any declaration for the UserEntityDAOImpl or Assembler beans in your context, and no component scanning to auto-detect it.

    You either need to declare them alongside the UserDetailsServiceImpl, or add a <context:component-scan> somewhere.

    0 讨论(0)
  • 2021-02-04 21:13

    i think you forgot to define UserEntityDAO in your app context.

    0 讨论(0)
提交回复
热议问题