I need create some fork for project.
So for some beans that depends from configuration I need to add some fields.
For this purpose I use DI like:
<bean id="MainBean" >
<property name="addProperty" >
<bean class="org.springframework.beans.factory.config.PropertyPathFactoryBean">
<property name="targetObject" ref="${my.add}"/>
<property name="propertyPath" value="add.prop"/>
</bean>
</property>
So in myapp.properties I write:
my.add=project2.add
Seems it works. Does this way is correct?
If it works, it is correct. What you should ask yourself, is it understandable to someone else. In the long term, will another person tasked with maintaining your solution be able to understand what you’ve done and why? Perhaps you need to document this somehow for the person coming in after you.