title: Injecting parent classes from other libraries with Guice
body: <p>I am trying to use Guice (4.0) to bootstrap dependencies for my executable from inside my main driver class (perhaps this is a Guice anti-pattern?):</p>
  
  <pre><code>// Groovy pseudo-code
  // This Buzz class is located in a 3rd party lib that I don't have access to
  class Buzz {
      int foobaz
      Whistlefeather whistlefeather
  
      // other stuff, include constructor, setters and getters
  }
  
  class MyApp extends Buzz {
      @Inject
      DatabaseClient dbClient
  
      @Inject
      FizzRestClient fizzClient
  
      static void main(String[] args) {
          MyApp app = Guice.createInjector(new MyAppModule()).getInstance(MyApp)
          app.run()
      }
  
      private void run() {
          // Do your thing, little app!
      }
  }
  
  class MyAppModule extends AbstractModule {
      @Override
      void configure() {
          bind(DatabaseClient).to(DefaultDatabaseClient)
          bind(FizzRestClient).to(DefaultFizzRestClient)
  
          // But how do I configure MyApp's 'foobaz' and 'whistlefeather'
          // properties? Again, I don't have access to the code, so I
          // can't annotate them with @Inject, @Named, etc.
      }
  }
  </code></pre>
  
  <p>So my problem is that <code>MyApp</code> actually extends a base object living in a 3rd party (OSS) JAR. This base class (<code>Buzz</code>) is not set up for use with Javax Inject or Guice. But I would like Guice to be able to configure its <code>foobaz</code> and <code>whistlefeather</code> properties.... any ideas?</p>