title: how to merge properties from one Java object to another in Java using Spring [SpEL]?
body: <p>I'm using Spring but not that familiar with all its capabilities. Looking for a good way to copy fields from one Java object instance to another. I've seen <a href="https://stackoverflow.com/questions/835416/how-to-copy-properties-from-one-java-bean-to-another">How to copy properties from one Java bean to another?</a> but what i'm looking for is more specific, so here are the details:</p>
  
  <p>Suppose I have two instances of some class P, source &amp; target, which have getters and setters a,b,c,d and 20 others.
  I want to copy the properties of of source into target, but only for all properties in a list of property names. It does not matter what is the value of any property in either source or target.<br>
  In other words, if the list is {"a", "b"}<br>
  then i just want the following to happen:  </p>
  
  <pre><code>P source;
  P target;
  List&lt;string&gt; properties; 
  
  //source, target are populated. properties is {"a", "b"}  
  //Now I need some Spring (SpEL?) trick to do the equivalent of:
  target.setA(source.getA());
  target.setB(source.getB());
  </code></pre>