Published by Christian Dupuis 2 years, 1 month ago
In case you have missed it: recent post-M4 nightly builds of Spring IDE contain basic support for Spring JavaConfig.
Just add the ConfigurationPostProcessor and a bean that is annotated with @Configuration to your bean definition XML file. Spring IDE will parse the configuration class and create bean definitions for every bean creation method - method annotated with @Bean - found in the class hierachy.
At the moment the support does not create bean dependencies by parsing the code of the bean creation method like it was implemented in an earlier prototype - is this feature actually desirable. Furthermore the @SpringAdvisor and @SpringAdvice annotations are not recognized by Spring IDE. Both features will be added later.
Note the little @ overlay image on the beans in the Spring Explorer and Beans Cross References View in the following screenshot. This overlay indicates a bean created by the ConfigurationPostProcessor.

Published by Christian Dupuis 2 years, 7 months ago
in Journal.
I personally think that the Java configuration option for Spring is a very clever move of Rod and Co. Since reading Rod’s post and playing around with the new configuration approach, I thought it would be very nice if Spring IDE could bring the two worlds-XML and Java configuration-together and seamlessly support the user with content assist, navigation support and graphical visualization of bean definitions across both configuration styles.
Today I implemented an extension prototype for Spring IDE’s internal bean definition parsing to see if it is possible to support the annotation style. Thanks to Torsten’s core abstraction on top of Spring’s bean definitions and Eclipse’ internal Java model, I was able to parse the required meta information from a Java class which is annotated with @Configuration.
The code is not meant to be production ready, but serves as a proof-of-concept for us.

Above you can see an sample @Configuration class that defines three Spring beans: stefanie, rod, house The annotation-style beans are decorated with an @ icon in the Spring Beans view.
By leveraging Eclipse’ AST support I was able to parse the dependencies between different Spring beans from the Java code. For example the expression person.setHouse(house()); defines a dependency between the person and house bean. Even the reference to XML-configured bean-resolved by person.setHouse((House) getBean("company"));-can be extracted from the source code.
Therefore Spring IDE is able to bring up a Beans Graph for the sample that outlines the dependencies between Java and XML-configured beans.

Let me know what you think and if you want to see that support in Spring IDE 2.0. I will provide a download of the prototpye to play around with after some more testing.
Recent Activity
benyan, Axel Mendoza Pupo, Christian Dupuis, Ryan Ovrevik, Jeremy D. Young, Tareq
Ricardo
Tony, James, Radek, Radek, jack, nicholas, cj, spinbox, Brad, Brad [...]
Sam, Petri Sirkkala, en3rgizer
hesy, Propecia, Jon, prande, Brice
joshmerry, IGC, guddu, antonio, Narada, Rakesh, Christian Dupuis, Christian Dupuis, Who Ever, KingSun [...]