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:com.karriem.tp2.principles_assignment.PLKTest.Compliance.PLKComplianceNGTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    service = (WorkLoad) ctx.getBean("doc");
}

From source file:com.tracy.designprinciples.lsp.correction.LSPCorrectionTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx1 = new AnnotationConfigApplicationContext(AppConfig.class);
    teacher = (Teach2) ctx1.getBean("LspC1");

    ApplicationContext ctx2 = new AnnotationConfigApplicationContext(AppConfig.class);
    stud = (SchoolMemb2) ctx2.getBean("LspC2");
}

From source file:hub.Application.java

public static void main2(String[] args) throws ValueException, ThingException, InterruptedException {

    AbstractApplicationContext context = new AnnotationConfigApplicationContext(HubConfigJpa.class);

    MongoOperations mo = (MongoOperations) context.getBean("mongoTemplate");
    final ThingControl tc = (ThingControl) context.getBean("thingControl");

    //        for ( String s : context.getBeanDefinitionNames() ) {
    //            System.out.println(s);
    //        }//from w w  w .j a  va 2s . c o m

    //        Person p = new Person("markus", "binsteiner", "m.binsteiner@auckland.ac.nz");
    //        Thing<Person> tp = tc.createThing("markus", p);
    //
    //        Role r1 = new Role("role1");
    //        Thing<Role> tr1 = tc.createThing("group1", r1);
    //        Role r2 = new Role("role2");
    //        Thing<Role> tr2 = tc.createThing("group1", r2);

    //        Thing<Person> tp = tc.findUniqueThingMatchingTypeAndKey(Person.class, "markus", true).get();
    //
    //        List<Thing<Role>> tr = tc.findThingsForTypeAndKey(Role.class, "group1");
    //
    //        Thing<Role> tr1 = tr.get(0);
    //        Thing<Role> tr2 = tr.get(1);
    //
    //        tc.addChildThing(tp, tr1);
    //        tc.addChildThing(tp, tr2);
    //
    //
    //        List<Thing<Role>> t = tc.findThingsForType(Role.class);
    //
    //        t.stream().forEach(System.out::println);

}

From source file:cputgroup3a.assertarray.AssertArrayServiceTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    Aas = (AssertArrayService) ctx.getBean("AA");
}

From source file:serviceTests.StaffmembersUnderFortyTestNGTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    eBF = new EmployeesBelowForty();
}

From source file:serviceTests.ScheduleAppointmentTestNGTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    scheduleAppointment = new ScheduleAppointment();

}

From source file:com.banda.truckmanagement.ISP_Test.java

@BeforeClass
public static void setUpClass() throws Exception {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    dnlService = (DeliveryCostsImpl) ctx.getBean("ispDelivery");
    hrService = (HumanResourcesImpl) ctx.getBean("ispNotification");
    ntfMgr = (HR_NotificationManager) ctx.getBean("notification");
}

From source file:serviceTests.FireEmployeeTestNGTest.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(ConnectionConfig.class);
    fireEmployee = new FireEmployee();

    repo = ctx.getBean(StaffMemberRepository.class);
    repo.deleteAll();//from  ww w.  j av  a 2s . co  m

}

From source file:com.tracy.designprinciples.dip.correction.DipCorrectionTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx1 = new AnnotationConfigApplicationContext(AppConfig.class);
    teacher = (Teacher4) ctx1.getBean("DipC1");

    ApplicationContext ctx2 = new AnnotationConfigApplicationContext(AppConfig.class);
    principle = (Principle4) ctx2.getBean("DipC");
}

From source file:TestCases.TestArray.java

@BeforeClass
public static void setUpClass() throws Exception {
    ctx = new AnnotationConfigApplicationContext(Setup.class);
    ci = (ClassInterface) ctx.getBean("tests");
}