title: Registering an instance as 'singleton' bean at application startup
body: <p>I am playing around with Spring Boot and I am trying to construct an instance of <code>ServiceImpl</code> to be resolved when a <code>Service</code> is required. Currently I am annotating the implementation as <code>@Component</code> but this does not give me the chance to construct the instance as I want.</p>
  
  <p>The <code>ServiceImpl</code> should be constructed with a String containing a path to a file on disk. I would like to do this in the main method of the <code>@SpringBootApplication</code> class of the application.</p>
  
  <p>Maybe it's just me coming from a long .NET background where we usually setup the IoC container like:</p>
  
  <pre><code>Service service = new Service("C:\\data.bin");
  container.RegisterSingleton&lt;IService&gt;(service); // now whoever asks for a IService will receive this precise instance
  </code></pre>
  
  <p>Does this make sense in Spring world?</p>
  
  <p>LE: I am well aware of the GoF singleton definition (i.e. prevent everyone else from creating instances of the class) - I am not targeting this.</p>