2017-04-03 138 views
0

包括spring安全啓動程序依賴項使得AuthenticationManager在Spring啓動應用程序中可用。我可以簡單地Autowire AuthenticationManager。 SpringBoot如何理解自動實例化AuthenticationManager的bean,雖然它位於一個非常不同的jar文件中?AuthenticationManager實現如何在SpringBoot應用程序中實例化

例如,

我可以簡單的寫

@Autowire 的AuthenticationManager authManager;

在我的SpringBoot應用程序中包含依賴項後。 Spring如何知道它應該實例化哪個類以及如何實現?

回答

0

org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration導入配置類org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration,其然後提供用於AuthenticationManager豆(它將使用的助洗劑,根據其提供的配置來構建所述認證管理器)。

相關問題