简体   繁体   English

IntelliJ中未解决的Spring bean

[英]Spring beans unresolved in IntelliJ

I started a project with IntelliJ that worked well but did something that broke it. 我与IntelliJ一起开始了一个项目,该项目效果不错,但做了一些破事。 Here is my applicationContext.xml file. 这是我的applicationContext.xml文件。

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
   xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean class="foo.Bar" />
</beans>

When inspecting the file I get the error 检查文件时出现错误

Cannot resolve bean 'foo.Bar' 无法解析bean'foo.Bar'

The same thing happens for all classes I try to put in my spring configuration file. 对于所有尝试放入spring配置文件中的类,同样的事情也会发生。 Any clue about that ? 有什么线索吗?

Here are the screenshots : 这是屏幕截图:

spring file error : https://drive.google.com/file/d/0BwhIWYS5TjDRaWxjUzhBbDVnNk0/view?usp=sharing 春季文件错误: https//drive.google.com/file/d/0BwhIWYS5TjDRaWxjUzhBbDVnNk0/view?usp = sharing

spring facet : https://drive.google.com/file/d/0BwhIWYS5TjDRb1RHbGlCOW9xeTg/view?usp=sharing 弹簧面: https : //drive.google.com/file/d/0BwhIWYS5TjDRb1RHbGlCOW9xeTg/view? usp =sharing

I use Maven to import jars and the classes exist in my classpath. 我使用Maven导入jar,并且类存在于我的类路径中。 But the code assist doesn't give me any tip when I edit the bean class property. 但是,当我编辑bean类属性时,代码辅助并没有给我任何提示。

Without a screenshot of IntelliJ its hard to find out, but here is my shortlist: 没有IntelliJ的屏幕截图,很难找到,但是这是我的候选清单:

1) did you configure the IntelliJ Spring facet to include your xml file? 1)您是否已将IntelliJ Spring方面配置为包括xml文件? To check that, hit F4 while selecting the root of the project tree and see the Facet configuration for Spring. 要进行检查,请在选择项目树的根目录时按F4键,然后查看Spring的Facet配置。 There your xml file must be listed. 必须列出您的xml文件。

2) you really have package "foo" with the Class "Bar.java" under your "sources" folder in IDEA ? 2)您真的在IDEA的“ sources”文件夹下有类“ Bar.java”的“ foo”包吗?

Without full log-trace, I can only make assumption on why this is happening 没有完整的日志跟踪,我只能假设为什么会发生这种情况

  1. Did not include required dependencies (JARs) 不包括必需的依赖项(JAR)
  2. You have not created foo.Bar class in your classpath 您尚未在类路径中创建foo.Bar类

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Intellij 13 JSF对Spring Bean的支持 - Intellij 13 JSF Support for Spring Beans Intellij @自动接线。 找不到匹配的春豆 - Intellij @Autowired. No matching spring beans found 如何在 Intellij 中使用 bean 创建基本的 spring 应用程序 - How to create a basic spring application using beans in Intellij 使用Spring Boot的intelliJ想法上有许多未解决的符号 - Lots of unresolved symbols on intelliJ idea using spring boot IntelliJ 和 Spring 启动测试:未解析的 bean,无法自动装配 - IntelliJ and Spring boot test: unresolved bean, could not autowire IntelliJ 13中未解决的错误 - Unresolved errors in IntelliJ 13 春天避免使用bean:beans而是编写bean? - Spring avoiding beans:beans and writing beans instead? 独立的Java应用程序,在Spring Application Context中没有创建bean吗? (IntelliJ,JavaConfig) - Standalone Java Application, no beans get created in the Spring Application Context? (IntelliJ, JavaConfig) Spring DatastoreRepository bean 在运行时无法解析,但 Intellij 在构建时显示没有错误 - Spring DatastoreRepository beans cannot be resolved at runtime, but Intellij shows no errors when building 从 jar 和 IntelliJ 运行时,Spring 以不同的顺序自动装配 bean - 无法启动 bean &#39;subProtocolWebSocketHandler&#39; 没有处理程序 - Spring autowires beans in different order when running from jar vs IntelliJ - Failed to start bean 'subProtocolWebSocketHandler' No handlers
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM