title: Letting Spring Boot manage the lifetime of my objects
body: <p>I am new to Spring Boot and still trying to grasp best practices. What attracted me was Spring Cloud Configuration. Initially I wanted to do a hybrid implementation (due to the size of the existing code base) of Spring Boot but it inevitably lead me to a bunch of code smell and anti-patterns.</p>
  
  <p>Before Spring, I was managing my own objects but I've quickly realized that Spring wants full control of object instantiation and ownership where there is dependency injection (which I understand). However there are some cases where I cannot let Spring completely drive but still have a dependency on configuration (e.g. another framework responsible for object management).</p>
  
  <p>I don't want to do a one off scenario where I end up passing configuration through a chain of constructors and I want to avoid using <code>AutowireCapableBeanFactory::autoWireBean(...)</code> to manually wire my beans. At the same time, relying on Spring to manually initialize all my objects is a nuisance. To be clear, this is what I am talking about:</p>
  
  <pre><code>@SomeOtherFrameworkThatOwnsThisObject
  @Configuration
  public class SomeClassDeepInMyProject implements SomeKindOfInterface {
  
      @Autowired
      private ConfigurationController config;
  
      ...
  }
  </code></pre>
  
  <p>I considered creating a singleton configuration provider that is accessible application wide and manually wiring the configuration bean to the class. If there is a better alternative, I am all ears.</p>