0
如何在我的自定義類中獲取AuthenticationManager bean?類WebApplicationContext和ApplicationContext沒有方法getBean(「refBean」)。請幫幫我!在spring security中獲取AuthenticationManager
如何在我的自定義類中獲取AuthenticationManager bean?類WebApplicationContext和ApplicationContext沒有方法getBean(「refBean」)。請幫幫我!在spring security中獲取AuthenticationManager
春季安全配置定義一個別名,你的認證管理器:
<authentication-manager alias="authenticationManager">
然後你可以在一些春天注入它管理使用的bean註釋:
@Autowired
@Qualifier("authenticationManager")
private AuthenticationManager authenticationManager;
注意:您需要一個限定詞,因爲在運行時有多個AuthenticationManager類型的bean。