Within a Unit/Integration Test, I'm trying to use the RESTEasy embedded server `TJWSEmbeddedJaxrsServer` or `POJOResourceFactory` inorder to simulate through a `MockHttpRequest.get("/data")` a resource call for test purpose.
My problem is that based on the use of the server or the Resource factory I'm not able to have a non null instance of spring beans which are injected normally within my resources.

Here's some code for clarification, thanks in advance.

**Spring application context :**

```
<context:annotation-config />
<context:component-scan base-package="com.cdcfast.service" />
<bean id="simpleResource" class="com.cdcfast.rest.SimpleResource" />

```

**SimpleResource.java :**

```
@Component
@Path("/data")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public class SimpleResource {

@Autowired
private SimpleService service;

@GET
@Produces(MediaType.APPLICATION_JSON)
public List<Data> getData() {
    return MockDataBase.getInstance().getRows();
}

```

**Unit Test :**

```
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath*:/test/spring/testApplicationContext.xml" })
public class FakeTest {

private Dispatcher dispatcher;

@Before
public void before() {
    dispatcher = MockDispatcherFactory.createDispatcher();
    POJOResourceFactory noDefaults = new POJOResourceFactory(SimpleResource.class);
    dispatcher.getRegistry().addResourceFactory(noDefaults);
}

@Test
public void aTestThatAlwaysPass() throws URISyntaxException {
    MockHttpRequest request = MockHttpRequest.get("/data");
    MockHttpResponse response = new MockHttpResponse();
    dispatcher.invoke(request, response);
    Assertions.assertThat(response.getStatus()).isEqualTo(HttpServletResponse.SC_OK);
    Assertions.assertThat(response.getContentAsString()).isNotNull().isNotEmpty();
}

}

```