I wrote some generic bean conversion that used together to convert a complex bean. Sometimes the input bean has bi-directional reference, and the converter traps in an infinite loop. How can I manage that?
For example the input is A bean that has relation to B bean and B bean has relation to exactly the A instance. When converting the A object starts, the B converter invokes to convert the b field in A, and also on converting the B object, A converter invokes to convert the a field in the B class, and as you know, the converter traps on infinite loop. Think about a more complex relation between beans that the relation graph has more than two nodes.
How can I avoid this infinite recursion in the converters?