Don’t Forget To Describe Your constructor-arg
January 20, 2006 – 22:47 | java, springOne often overlooked feature in Spring bean definitions is the ability to add a <description> element to almost everything: beans, properties, or constructor arguments. It makes a lot of sense especially in the case of <constructor-arg>, because usually setting a bean property is fairly obvious:
XML:
-
<property name="timeInterval" value="100"/>
But not so when the above is done in a <constructor-arg>. Constructor arguments are not looked up by name, but by index or type:
XML:
-
<constructor -arg index="0" value="100"/>
Instead, this would make it a lot clearer:
XML:
-
<constructor -arg index="0" value="100">
-
<description>For the time interval. In milliseconds.</description>
-
</constructor>
My only wish is for the Spring team to consider adding a 'description' attribute.
