title: How to inject Spring Bean for factory method requiring MyClass.class parameter
body: <p>I'm trying to inject a java.util.prefs.Preferences bean in to my master controller. The controller looks like:</p>
  
  <pre><code>@Controller
  class MyController {
      @Autowired
      private Preferences preferences;
  }
  </code></pre>
  
  <p>The application-context.xml file creates the bean for java.util.prefs.Preferences. It uses a factory method so I have the following entry for creating the bean:</p>
  
  <pre><code>&lt;bean id="preferences" class="java.util.prefs.Preferences" factory-method="userNodeForPackage" /&gt;
  </code></pre>
  
  <p>Preferences.userNodeForPackage(param) takes for a parameter the class related to the Preference. In this case Spring needs to create the bean by performing the call: </p>
  
  <pre><code>Preferences.userNodeForPackage(MyController.class);
  </code></pre>
  
  <p>How can a class be passed in to a spring bean instantiated with a factory method?
  Thanks</p>
  
  <p>Environment information:</p>
  
  <pre><code>Java 7
  Spring 3.1
  </code></pre>