Grails spring bean未加载(自定义UserDetailsS​​ervice)

时间:2015-09-14 14:55:39

标签: grails spring-security spring-bean

我使用Spring Security Plugin的自定义实现来覆盖默认的loadUser函数。我阅读了本手册https://grails-plugins.github.io/grails-spring-security-core/guide/userDetailsService.html,这是我的resources.groovy文件:

package spring

import security.ExtendedUserDetails
beans = {
  UserDetailsService(ExtendedUserDetails)
}

但它没有加载。 App仍然使用默认的puligin实现GormUserDetailsS​​ervice。我使用调试器,我发现ExtendedUserDetails永远不会运行。

那有什么不对?

这个问题还没有答案 Custom UserDetailsService Not Being Called - Grails & Spring Security Core

1 个答案:

答案 0 :(得分:1)

Looks like there is a typo in your bean name in resources.groovy. The name must be userDetailsService not UserDetailsService (capital U) and ExtendedUserDetails must implement GrailsUserDetailsService.