Search in sources :

Example 1 with DefaultInjector

use of org.apache.cayenne.di.spi.DefaultInjector in project cayenne by apache.

the class WebModuleTest method testBind_Scopes.

@Test
public void testBind_Scopes() {
    Injector injector = new DefaultInjector(new WebModule());
    RequestHandler handler = injector.getInstance(RequestHandler.class);
    assertTrue(handler instanceof SessionContextRequestHandler);
    RequestHandler handler1 = injector.getInstance(RequestHandler.class);
    assertNotSame("Incorrect singleton scope for request handler", handler, handler1);
}
Also used : Injector(org.apache.cayenne.di.Injector) DefaultInjector(org.apache.cayenne.di.spi.DefaultInjector) DefaultInjector(org.apache.cayenne.di.spi.DefaultInjector) Test(org.junit.Test)

Aggregations

Injector (org.apache.cayenne.di.Injector)1 DefaultInjector (org.apache.cayenne.di.spi.DefaultInjector)1 Test (org.junit.Test)1