eclipse Spring Explorer 未显示 bean 定义文件中的 bean
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1579710/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Spring Explorer not showing beans from bean definition file
提问by Stefan Kendall
I just downloaded the Springsource Tool Suite, and I created a simple bean configuration file called myDefinition.xml and placed it in the root directory of the Spring Project. However, the Spring Explorer is not showing any data. I'm using eclipse 3.5 and the latest SpringSource all-in-one installation.
刚刚下载了Springsource Tool Suite,创建了一个简单的bean配置文件myDefinition.xml,放在Spring项目的根目录下。但是,Spring Explorer 没有显示任何数据。我正在使用 eclipse 3.5 和最新的 SpringSource 多合一安装。
Also, if I specify invalid property names in the configuration file, I get no error. Autocomplete, however, is working.
此外,如果我在配置文件中指定无效的属性名称,则不会出错。但是,自动完成正在起作用。
Thoughts?
想法?
回答by Jeff Storey
In the Spring Explorer tab in Eclipse, right click on your project > properties. Then go to Spring > Beans Support and select the Config Files tab. You can then select files or scan a directory and that should add them. I haven't found a way to autoscan a directory so I don't have to do this whenever I add a new spring bean file. The beans that appear in that list are stored in the .springbeans file.
在 Eclipse 的 Spring Explorer 选项卡中,右键单击您的项目 > 属性。然后转到 Spring > Beans Support 并选择 Config Files 选项卡。然后,您可以选择文件或扫描目录,然后添加它们。我还没有找到自动扫描目录的方法,所以每当我添加一个新的 spring bean 文件时我都不必这样做。出现在该列表中的 bean 存储在 .springbeans 文件中。
回答by Claudio030
Just want to add that if you want to generate a diagram of a webflow of an existing project, you have to right-click said project in Eclipses Project Explorer and "Add Spring Project Nature" by using the Spring Tools entry of the context menu.
只想补充一点,如果要生成现有项目的 webflow 图表,则必须在 Eclipses Project Explorer 中右键单击该项目,然后使用上下文菜单的 Spring Tools 条目“添加 Spring 项目性质”。
回答by Abdull
There currently (as of 2012-04-10) seem to be problems with the Spring Explorer view when using a purely annotation driven bean definition (i.e. using Java annotations to wire everything up instead of using XML files).
当前(截至 2012 年 4 月 10 日)在使用纯注释驱动的 bean 定义(即使用 Java 注释来连接所有内容而不是使用 XML 文件)时,Spring Explorer 视图似乎存在问题。
There is a workaround though, by providing a minimum XML file that declares scanning for components. http://forum.springsource.org/showthread.php?118928-Spring-Explorer-with-Java-based-Web-Container-configuration
不过,有一种解决方法,即提供一个声明扫描组件的最小 XML 文件。 http://forum.springsource.org/showthread.php?118928-Spring-Explorer-with-Java-based-Web-Container-configuration
Unfortunately, this procedure is still flawed, missing some components.
不幸的是,这个程序仍然存在缺陷,缺少一些组件。
回答by vimal krishna
Just to add Claudio030
只是为了添加 Claudio030
Make sure you have JEE perspective selected for your project, otherwise it won't show in Java perspective.
确保为您的项目选择了 JEE 透视图,否则它不会显示在 Java 透视图中。