Is there is a way to generate full XML configuration file based on Spring 3 annotations scattered all over the classes?
Ideally, I'm looking for a tool that can "parse" a Spring 3 project and output XML configuration, something like xdoclet was doing (but off course from Spring annotations)
Is there a tool like this, or a way I could write my own if none exists?
Starting from Spring 2.5 it became possible to configure the dependency injection using annotations. So instead of using XML to describe a bean wiring, you can move the bean configuration into the component class itself by using annotations on the relevant class, method, or field declaration.
Java and XML configuration are not exclusive - both can be used inside the same Spring application. In order to retrieve a bean from an XML file, one has to use the Spring container. As mentioned, one can achieve this with @ExternalBean annotation (the recommended way).
XML configurations can take a lot of work when there are a lot of beans, while annotations minimize the XML configurations. Annotation injection is performed before XML injection. Thus, XML configurations will override that of the annotations.
You can always write your own. I'm not aware of one.
Funny, because annotations were added because some people complained about heavy XML configuration. You're swimming against the tide here.
Just curious - why do you want the XML now? Why aren't the annotations sufficient?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With