title: Axon Testing: Missing Context
body: <p>In an Axon-SpringBoot App I have an aggregate that uses an injected DAO in some of its command handlers.</p>
  
  <p>For instance:</p>
  
  <pre><code>@Aggregate
  class MyAggregate {
  
      @CommandHandler
      public MyAggregate (CreateMyAggregateCommand command, @Autowired MyAggregateDao dao) {
  
            final SomeProperty = command.getSomePoprtery();
  
            if (dao.findBySomeProperty(someProperty) == null) {
                 AggregateLifeCycle.apply(
                       new MyAggregateCreatedEvent(command.getIdentifier(),
                                                   someProperty);
            } else {
                 // Don't create, already exits with some property
                 // report ...
            }
      }
  
  }
  </code></pre>
  
  <p>A standard test like</p>
  
  <pre><code>@Test
  void creationSucceeds () {
  
      aggregateTestFixture = new AggregateTestFixture&lt;&gt;(MyAggregate.class);
  
      final CreateMyAggregateCommand command = new CreateMyAggregateCommand(...);
      final MyAggregateCreatedEvent = new MyAggregateCreatedEvent(...);
  
      aggregateTestFixture
              .givenNoPriorActivity()
              .when(command)
              .expectEvents(event);
  
  }
  </code></pre>
  
  <p>fails with:</p>
  
  <pre><code>org.axonframework.test.FixtureExecutionException: No resource of type 
  [com.xmpl.MyAggregateDao] has been registered. It is required 
  for one of the handlers being executed.
  </code></pre>
  
  <p>How can I provide a test implementation?</p>