Some of my classes have final fields that are populated from the constructor as well as properties that can be assigned from getters and setters.
If I can do this using spring, what does the springcontext.xml file look like that creates objects in this way?
Thank you
<bean id="testWithConstructorArg"
class="com.Test">
<constructor-arg ref="referencingSomething"/>
</bean>
more: http://www.javalobby.org/java/forums/t18396.html
<bean id="myBean" class ="com.example.MyClass">
<constructor-arg type="java.lang.String">
<value>hello world</value>
</constructor-arg>
</bean>
then you can have the normal setter/getter based <paramater name="blah" value="whatever"/>
as usual.
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