title: Spring: Injecting a private inner class as an outer class's member?
body: <p>I have the following class structure</p>
  
  <pre><code>public class Outer{
      private Mapper a;
      ....
  
      private class MapperA implements Mapper {
  
      }
  
      private class MapperB implements Mapper {
  
      }
  }
  </code></pre>
  
  <p>In my Spring config file I would like to create a an Outer bean, and assign one of MapperA or MapperB as a property. Is this possible?</p>
  
  <pre><code>&lt;bean id="outer" class="mypackage.Outer"&gt;
      &lt;property name="a" ?????='????' /&gt;
  &lt;/bean&gt;
  </code></pre>
  
  <p>Edit:  Some more info, based on the feedback from answers:</p>
  
  <ol>
  <li><p>I got lazy with my above example. I do have a public setter/getter for the Mapper instance variable.</p></li>
  <li><p>The reason all of the Mapper classes are inner classes is because there could potentially be many of them, and they will only ever be used in this class.  I just don't want a ton of cruft classes in my project.  Maybe a factory method is a better idea.</p></li>
  </ol>