- Where Developers Learn, Share, & Build Careers
I have several spring beans in which the property value is the same for all of How to set Try this way. class 1 & amp; A common field name for Class 2 is "AmphilD", the original attribute is only used for this common purpose. In the spring it is called Bean Definition Heritage (This is not Java class succession, for example above class 1 and N class is not to inherit in its respective java file.) For more information, check Spring Dock. string . Is there any way where I can define
string in XML at one place and can reference it in all the beans on the value settings of the property?
& lt; Bean id = "some bean" class = "test.SomeBean" & gt; & Lt; Property Name = "Property 1" Ref = "Some Value" & gt; & Lt; / Property & gt; & Lt; Property Name = "General Property" Value = "General Value" & gt; & Lt; / Property & gt;
& lt; Bean id = "next bean" class = "test.extBean" & gt; & Lt; Property name = "property 2" ref = "some value" & gt; & Lt; / Property & gt; & Lt; Property Name = "General Property" Value = "General Value" & gt; & Lt; / Property & gt;
commonValue in a different place and see it in both places?
& lt; Bean id = "commonConfig" abstract = "true" & gt; & Lt; Property Name = "Amphil" Value = "General Value" & gt; & Lt; / Property & gt; & Lt; / Bean & gt; & Lt; Bean id = "class 1" class = "com.dataclass.Class1" parent = "commonConfig" & gt; & Lt; Property Name = "Field 1" Value = "Value 1" & gt; & Lt; / Property & gt; & Lt; / Bean & gt; & Lt; Bean id = "square 2" class = "com.dataclass.Class2" parent = "commonConfig" & gt; & Lt; Property Name = "Field2" Value = "Value 2" & gt; & Lt; / Property & gt; & Lt; / Bean & gt;
Comments
Post a Comment