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:PhotographTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    photo = (Photograph.Builder) ctx.getBean("photo");
    newPhoto = (Photograph.Builder) ctx.getBean("photo");
    aPhotographer = (Photographer.Builder) ctx.getBean("photographer");

}

From source file:LSPTest.LSPCorrectionTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    pers = (LSPPersonC) ctx.getBean("LSPCorrect");
}

From source file:BrandingTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    design = (Branding.Builder) ctx.getBean("branding");
    newDesign = (Branding.Builder) ctx.getBean("branding");
    ed = (Editor.Builder) ctx.getBean("editor");
}

From source file:LSPTest.LSPViolationTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    pers = (LSPPersonV) ctx.getBean("LSPViolate");
}

From source file:au.com.shawware.sandbox.persistence.JPAJavaConfigTest.java

/**
 * Set up the test harness before running any test.
 *//* w w  w  .j a va2s . c om*/
@BeforeClass
public static void setUp() {
    sContext = new AnnotationConfigApplicationContext(JPAConfiguration.class);
    sRepo = sContext.getBean(NodeRepository.class);
}

From source file:AssignmentTests.AsignmentTestNGTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    addition = new AdditionImpl();
    failureTest = new FailureTestImpl();
    nullOrNot = new NullOrNotImpl();
    objectComp = new ObjectCompImpl();
    trueOrFalse = new TrueOrFalseImpl();
    ApplicationContext ctx = new AnnotationConfigApplicationContext(Config.class);
    ctx.getBean("add");
    ctx.getBean("fail");
    ctx.getBean("isItNull");
    ctx.getBean("isItTrue");
    ctx.getBean("objectTheSame");

}

From source file:ru.elcor.mis.scheduler.core.Scheduler.java

public void doit() throws InterruptedException {
    ApplicationContext AppCxt = new AnnotationConfigApplicationContext(AppConfig.class);
    Job jobs = AppCxt.getBean(Job.class);
    for (int i = 0; i < 10; i++) {
        System.out.println("soy");
        Thread.sleep(1000);//from w w w.  j  a va  2s .c  o m
    }
}

From source file:OCPTest.OCPViolationTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    pers = (Person) ctx.getBean("OCPschool");
}

From source file:cputgroup3a.calculator.CalculatorTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    cs = (CalculatorService) ctx.getBean("calculator");
    cs2 = (CalculatorService) ctx.getBean("calculator");
}

From source file:cputgroup3a.assertingtruefalse.AssertingTrueFalseTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    tf = (AssertingTrueFalseImpl) ctx.getBean("TrueFalseAssert");
}