I have java beans:
package com.denisk.beans;
...
public class SomeBean {
private String someProperty;
private AnotherBean anotherBean;
...
}
public class AnotherBean {
private String anotherProperty;
....
}
I want to generate a stub xml spring configuration for these beans, something like
<beans>
<bean id="someBean">
<property name="someProperty" value="sldfjslkdfjas;lfj"/>
<property name="anotherBean" ref="anotherBean"/>
</bean>
<bean id="anotherBean">
<property name="anotherProperty" value="klj;df;ksdjflsjkd;lfj"/>
</bean>
</beans>
I want this to be done using some tool, which would accept a path to my beans as an input, like that:
denisk@denisk-work:~$ generateSpringXml -p "/home/denisk/myProject/src/main/java/com/denisk/beans" -output "/home/denisk/mySpringConfig.xml"
Shouldn't be a big deal, but I can't google out anything like that.
Thanks
Check this out:
https://github.com/mangstadt/Spring-Application-Context-Generator
This will take a list of Java classes and generate the XML bean definitions for them. It generates a <bean />
element for each public class, a <property />
element for each public field and setter method, and a list of <constructor-arg />
elements if there is only one constructor and that constructor is not the default constructor.
Example:
java com.mangst.appcontext.ApplicationContextGenerator --source=/home/denisk/myProject/src/main/java --package=com.denisk.beans
If you try this out, let me know if there are any problems so I can make improvements.
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