title: Simple Java field injection with Micronaut what's the missing step(s)?
body: <p>I am not sure <em>yet</em> if I'm on the wrong track or not.  There is an example on the <a href="https://docs.micronaut.io/latest/guide/index.html#beans" rel="nofollow noreferrer">Micronaut Getting Started</a> page for a V8 Engine and injecting a Vehicle.</p>
  
  <ul>
  <li><a href="https://docs.micronaut.io/latest/guide/index.html#beans" rel="nofollow noreferrer">Defining Beans</a> (often used Engine interface example)</li>
  </ul>
  
  <p>With that example in mind.  What is the most straightforward way to implement "Model A" with Micronaut using Java?  If there's no direct approach, what is the closest hands-off method with Micronaut?</p>
  
  <p>My simple vision of vanilla field injection stepping-on with such an example is as so (using Java), I'm labelling it "Model A" ...</p>
  
  <p><strong>Model A</strong></p>
  
  <pre><code>  import io.micronaut.context.*
  
    public class MyApp {                        // (A)
  
        @Inject 
        Vehicle vehicle;
  
  
        public void runApp( String... args ){
  
           println( vehicle.start() )
        }
  
        public static main( String... args ){
  
            //   whatever set-up and steps need   // (B)
            //   for auto-inject / auto-wiring.
  
            MyApp body = new MyApp( args  );
  
            body.runApp();                       // (C)
        }
    }
  </code></pre>
  
  <p>Where the annotation processor uses provides an instance of the <code>@Singleton</code> <code>Vehicle</code> in this example.  Or creates a new instance in the case of non-singleton-s.</p>
  
  <p>Either way the result of the process <em>would be</em> that I don't need to write code to 'instantiate' the code or find a factory to do so explicitly.</p>
  
  <p>The example itself goes on to demonstrate the method I'll label "Model B"  (using Groovy)...</p>
  
  <p><strong>Model B</strong></p>
  
  <pre><code>  import io.micronaut.context.*
      ...
    Vehicle vehicle = BeanContext.run().getBean(Vehicle)
  
    println( vehicle.start() )
  </code></pre>
  
  <p>Which in fact is MORE typing than just writing:</p>
  
  <pre><code>  Vehicle vehicle = new Vehicle();
  
        //    OR
  
    Vehicle vehicle = Vehicle.getInstance();
  </code></pre>
  
  <p>With some libraries you need to initialise the scopes or context, I see that.  The question boils donw to what must I do to inject Vehicle as shown in my code.</p>
  
  <p>I made a <code>@Singleton</code> and tried to <code>@Inject</code> the field.  The reference is NULL.  I then made a <code>@Provider</code>and set a break point. That isn't called.  </p>
  
  <ul>
  <li>can I do "Model A"?</li>
  <li>If yes, what needs to happen?</li>
  </ul>
  
  <p>I've scanned lots of examples doing great things. I'd love to get into those fancy things too.  Right now I'm in the basement looking for a way up to the ground floor.  Many thanks for you guidance.</p>