Example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

List of usage examples for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext

Introduction

In this page you can find the example usage for org.springframework.context.annotation AnnotationConfigApplicationContext AnnotationConfigApplicationContext.

Prototype

public AnnotationConfigApplicationContext(String... basePackages) 

Source Link

Document

Create a new AnnotationConfigApplicationContext, scanning for bean definitions in the given packages and automatically refreshing the context.

Usage

From source file:services.TotalBrandingByEditorTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    editor1 = new Editor.Builder("211").firstName("Tonata").lastName("Nakashololo").build();
    editor2 = new Editor.Builder("127").firstName("Nikki").lastName("Shiyagaya").build();
}

From source file:net.slkdev.swagger.confluence.cli.SwaggerConfluence.java

private static SwaggerToConfluenceService bootSwaggerConfluence() {
    final AnnotationConfigApplicationContext annotationConfigApplicationContext = new AnnotationConfigApplicationContext(
            SwaggerConfluenceContextConfig.class);
    final SwaggerToConfluenceService swaggerToConfluenceService = annotationConfigApplicationContext
            .getBean(SwaggerToConfluenceService.class);
    annotationConfigApplicationContext.close();

    return swaggerToConfluenceService;
}

From source file:ConfigClassInDefaultPackageUnitTests.java

/**
 * @see DATAMONGO-877/*from  w ww. j  av  a 2  s.c om*/
 */
@Test
public void loadsConfigClassFromDefaultPackage() {
    new AnnotationConfigApplicationContext(ConfigClassInDefaultPackage.class).close();
}

From source file:net.codestory.http.injection.SpringAdapter.java

public SpringAdapter(Class<?>... annotatedClasses) {
    this(new AnnotationConfigApplicationContext(annotatedClasses));
}

From source file:com.joconner.g11n.charprop.resource.HealthCheckResourceTest.java

@Override
public Application configure() {
    ApplicationContext context = new AnnotationConfigApplicationContext(CharpropApplication.class);
    config = new JerseyConfig();
    config.property("contextConfig", context);
    return config;
}

From source file:StudioTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    studio = (Studio.Builder) ctx.getBean("studio");
    studioNew = (Studio.Builder) ctx.getBean("studio");
    equipment = new ArrayList<Equipment>();

    Smartboard.Builder b = (Smartboard.Builder) ctx.getBean("smartboard");
    boardOne = b.name("SMART Tech: Smartboard").build();
    Camera.Builder c = (Camera.Builder) ctx.getBean("camera");
    camera = c.name("Canon D990").build();
    DesktopPC.Builder d = (DesktopPC.Builder) ctx.getBean("desktop");
    computer = d.name("Dell XP360").build();
}

From source file:net.codestory.http.injection.AbstractSpringConfiguration.java

protected AbstractSpringConfiguration(Class<?>... annotatedClasses) {
    beanFactory = new AnnotationConfigApplicationContext(annotatedClasses);
    onCreate(beanFactory);
}

From source file:com.oded.spring.data.elasticsearch.configuration.test.ApplicationTest.java

@Test
public void bootstrapsApplication() {
    new AnnotationConfigApplicationContext(ApplicationConfig.class);
}

From source file:example.lib.LibTest.java

@Test
public void bootstrapsRepository() {

    try (ConfigurableApplicationContext context = new AnnotationConfigApplicationContext(Lib.class)) {
        assertThat(context.getBean(LibRepository.class), is(notNullValue()));
        assertThat(context.getBean(LibComponent.class), is(notNullValue()));
    }/*from   w  w w. j  a v a2 s .com*/
}

From source file:com.kurtwasserfall.ooexampleondomain.PersonTest.java

@BeforeClass
public void setUpClass() {

    ApplicationContext ctxCust = new AnnotationConfigApplicationContext(CustomerConfig.class);
    ApplicationContext ctxEmp = new AnnotationConfigApplicationContext(EmployeeConfig.class);

    customerService = (CustomerService) ctxCust.getBean("cust");
    employeeService = (EmployeeService) ctxEmp.getBean("emp");
}