【问题标题】:How does AuthenticationManager implementation gets instantiated in SpringBoot AppAuthenticationManager 实现如何在 SpringBoot App 中实例化
【发布时间】:2017-04-03 11:20:48
【问题描述】:

包含 spring security starter 依赖使得 AuthenticationManager 在 spring boot 应用程序中可用。我可以简单地自动装配 AuthenticationManager。 SpringBoot 如何理解为 AuthenticationManager 自动实例化 bean,尽管它位于一个非常不同的 jar 文件中?

例如

我会写

@Autowire AuthenticationManager authManager;

在包含依赖项后在我的 SpringBoot 应用程序中。 spring 怎么知道它应该实例化哪个类以及如何实例化?

【问题讨论】:

    标签: spring-boot


    【解决方案1】:

    org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration 类导入配置类org.springframework.boot.autoconfigure.security.AuthenticationManagerConfiguration,然后为AuthenticationManager 提供bean(它将使用构建器根据提供的配置构建身份验证管理器)。

    【讨论】:

      猜你喜欢
      • 2011-07-22
      • 1970-01-01
      • 1970-01-01
      • 2016-10-04
      • 1970-01-01
      • 2014-12-06
      • 1970-01-01
      • 1970-01-01
      • 2020-11-08
      相关资源
      最近更新 更多