Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Explorer not showing beans from bean definition file

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.

Also, if I specify invalid property names in the configuration file, I get no error. Autocomplete, however, is working.

Thoughts?

like image 391
Stefan Kendall Avatar asked Oct 16 '09 18:10

Stefan Kendall


People also ask

How can I get bean defined in configuration Spring boot?

Declaring a bean. To declare a bean, simply annotate a method with the @Bean annotation. When JavaConfig encounters such a method, it will execute that method and register the return value as a bean within a BeanFactory .

How can we load all the bean configuration files?

You may load multiple Spring bean configuration files in the code : ApplicationContext context = new ClassPathXmlApplicationContext(new String[] {"Spring-Common. xml", "Spring-Connection. xml","Spring-ModuleA.

Where can I use @bean annotation?

Spring @Bean Annotation is applied on a method to specify that it returns a bean to be managed by Spring context. Spring Bean annotation is usually declared in Configuration classes methods. In this case, bean methods may reference other @Bean methods in the same class by calling them directly.


2 Answers

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.

like image 156
Jeff Storey Avatar answered Sep 28 '22 10:09

Jeff Storey


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.

like image 42
Claudio030 Avatar answered Sep 28 '22 12:09

Claudio030