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.github.sebhoss.contract.example.SpringSpELInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///from  w  w w .  j  a va2 s.c  om
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(SpringSpELConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:OCPTest.OCPCorrectionTest.java

@BeforeClass
public static void setUpClass() throws Exception {

    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    ocpInt = (OCPSchoolInterface) ctx.getBean("OCPCorrectschool");
}

From source file:com.github.sebhoss.contract.example.SpringJavaScriptInsuranceCompanyTest.java

/**
 * Creates a new insurance company for each test.
 *///from w  w  w.  ja  v a2s  .c o m
@Before
@SuppressWarnings(CompilerWarnings.RESOURCE)
public void createCompany() {
    final ApplicationContext context = new AnnotationConfigApplicationContext(
            SpringJavaScriptConfiguration.class);
    setInsuranceCompany(context.getBean(InsuranceCompany.class));
}

From source file:com.nkosy.chapter5.creational.factorymethod.TestFactoryMethod.java

@Before
public void setUp() {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(AppConfig.class);
    animalFactory = (AnimalFactory) ctx.getBean("factoryMethod");
}

From source file:com.jeroensteenbeeke.hyperion.events.AbortTest.java

@BeforeClass
public static void createApplicationContext() {
    testContext = new AnnotationConfigApplicationContext(TestConfig.class);
}

From source file:services.TotalWorkTypeTest.java

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

From source file:iqq.app.IMLauncher.java

/**
 * ??//  www . j  a v  a2 s . c  o  m
 */
private static void startup() {
    IMContext.init(new AnnotationConfigApplicationContext("iqq.app"));

    FrameManager frameManager = IMContext.getBean(FrameManager.class);
    frameManager.showLogin();
}

From source file:com.mycompany.config.MongoConfig.java

public static MongoOperations getMongoConnection() {
    ApplicationContext ctx = new AnnotationConfigApplicationContext(MongoConfig.class);
    MongoOperations mongoOperation = (MongoOperations) ctx.getBean("mongoTemplate");
    return mongoOperation;
}

From source file:com.geodevv.testing.irmina.bootstrap.IrminaBootstrap.java

public IrminaBootstrap() {
    internalContext = new AnnotationConfigApplicationContext(IrminaConfiguration.class);
    internalContext.registerShutdownHook();
}

From source file:de.olivergierke.deepdive.ApplicationTest.java

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