java - 无法 Autowiring 。找不到 bean 'here name' 类型

标签 java spring intellij-idea spring-security

创建了一个实现 AuthenticationSuccessHandler 的类,并添加了 @Component 守护进程以将其与 Spring Security 配置对象相关联。 https://zapodaj.net/b3085e4c1cd43.png.html

 @Component
 public class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler {..}

IntelliJ 向我展示了一条消息

Could not autowire. No beans of 'CustomAuthenticationSuccessHandler' type found

最佳答案

Intellij 并不总能解决 Autowiring 问题,即使应用程序运行良好。

如果它运行良好并且您没有遇到编译错误,请忽略它。

尝试运行重建项目来修复它。

您也可以将包列表添加到组件扫描

@ComponentScan(basePackages = { "com.a.b", "com.a.c" })

关于java - 无法 Autowiring 。找不到 bean 'here name' 类型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45491592/

相关文章:

java - 如何在运行时更改xml中的spring bean属性值?

java - 通过 Spring Batch 中的列顺序解析 csv

java.lang.NoSuchMethodError 当方法肯定存在时

java - 无法在 Intellij IDEA 中设置 Java 断点

java - CXF WebSocket 配置

java - 项目无法在 Google Cloud Tools for Eclipse 上启动

java - Android studio 中的时间选择器对话框

java - 通过序列化保存我的对象或创建 XML 文件

JavaFX CSS 错误(属性样式表不存在)

android - 在我的三星 Galaxy S10+ 上通过 IntelliJ/Android SDK 调试 Android 应用程序结果为 "Error while Installing APKs"