IntelliJ IDEA在使用Spring的@Autowired注释时显示错误
问题描述:
当我在类中使用Spring的@Autowired
批注时,IntelliJ IDEA显示错误,但是该类可以正常运行.
IntelliJ IDEA is showing errors when I use Spring's @Autowired
annotation in the class, but the class is functioning without any problem.
这是此错误消息:
必须在有效弹簧中定义自动装配的成员 豆(@ Component/@ Service等)少...(Ctrl + F1)检查自动装配 bean类中的问题.
Autowired members must be defined in the valid spring bean (@Component/@Service,etc.) less... (Ctrl+F1) Checks autowiring problems in a bean class.
答
我在IntelliJ IDEA 13.1.4中遇到了相同的问题 我通过删除Spring构面(文件"->项目结构")并将其保留为仅显示检测"来解决它.
I had the same problem with IntelliJ IDEA 13.1.4 I solved it by removing the Spring facet (File->Project Structure) and leaving it to just show "Detection".