title: is it possible to use Spring MVC Test directly in grails, and how?
body: <p>We think the <code>Spring Rest Doc</code> is great for documenting rest api. But it is based on <code>Spring MVC Test</code>，and we can't figure out how to use <code>Spring MVC Test</code> in my grails apps(Grails 3.0.5).</p>
  
  <p>I tried to use a config class (with <code>@Configuration</code> and<code>@ComponentScan</code>) to scan grails components into the test context, but it seems like nothing had been loaded (when performing a http request to the <code>mockmvc</code>, it got 404).</p>
  
  <p>I also tried to configure the grails controller directly, and got a run time error.</p>
  
  <blockquote>
    <p>Could not autowire field: private reactor.bus.EventBus</p>
  </blockquote>
  
  <p>I also tried to add <code>@Integration</code> (from grails) on the test class but recieved the same error.  </p>
  
  <p>Please help.</p>
  
  <p>Here are some code samples.
  what i tried was adding config class or class locations or grails controller to ContextConfiguration of the test class below. And the test class itself is basically following <code>spring rest doc</code> reference.</p>
  
  <pre><code>import org.junit.Before;
  import org.junit.Rule;
  import org.junit.runner.RunWith;
  import org.springframework.test.context.ContextConfiguration;
  import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
  import org.springframework.test.context.web.WebAppConfiguration;
  import org.springframework.test.web.servlet.MockMvc;
  import org.springframework.test.web.servlet.setup.MockMvcBuilders;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.web.context.WebApplicationContext;
  import org.springframework.restdocs.RestDocumentation;
  import static org.springframework.restdocs.mockmvc.MockMvcRestDocumentation.documentationConfiguration;
  
  @RunWith(SpringJUnit4ClassRunner.class)
  @WebAppConfiguration
  @ContextConfiguration
  //TODO how to scan Grails components into the test context
  public class QuestionRestSpec {
  @Rule
  public final RestDocumentation restDocumentation = new RestDocumentation("build/generated-snippets");
  @Autowired
  private WebApplicationContext context;
  
  private MockMvc mockMvc;
  
  @Before
  public void setUp() {
      this.mockMvc = MockMvcBuilders.webAppContextSetup(context)
              .apply(documentationConfiguration(this.restDocumentation))
              .build();
  }
  }
  </code></pre>
  
  <p>The config class(which has no use):</p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan
  public class AskConfig {
  }
  </code></pre>