當前位置: 首頁>>代碼示例>>Java>>正文


Java AnnotationConfigApplicationContext.start方法代碼示例

本文整理匯總了Java中org.springframework.context.annotation.AnnotationConfigApplicationContext.start方法的典型用法代碼示例。如果您正苦於以下問題:Java AnnotationConfigApplicationContext.start方法的具體用法?Java AnnotationConfigApplicationContext.start怎麽用?Java AnnotationConfigApplicationContext.start使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.context.annotation.AnnotationConfigApplicationContext的用法示例。


在下文中一共展示了AnnotationConfigApplicationContext.start方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: testSpring

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
@Test
public void testSpring() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfig.class);
    ctx.start();

    try {
        Engine engine = ctx.getBean(Engine.class);

        await().atMost(30, TimeUnit.SECONDS).until(() -> engine.getOperations().getVariable(String.class, "springBeanValue") != null);

        assertEquals(BEAN_VALUE, engine.getOperations().getVariable(String.class, "springBeanValue"));
        assertFalse(engine.isError());
    } finally {
        ctx.close();
    }
}
 
開發者ID:softelnet,項目名稱:sponge,代碼行數:17,代碼來源:SpringTest.java

示例2: start

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
public void start() {
    String configPath = ConfigUtils.getProperty(SPRING_JAVACONFIG);
    if (configPath == null || configPath.length() == 0) {
        configPath = DEFAULT_SPRING_JAVACONFIG;
    }
    context = new AnnotationConfigApplicationContext(configPath);
    context.start();
}
 
開發者ID:zhuxiaolei,項目名稱:dubbo2,代碼行數:9,代碼來源:JavaConfigContainer.java

示例3: setUp

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
@Before
public void setUp() {
    context = new AnnotationConfigApplicationContext(SearchConfiguration.class);
    context.start();

    repository = context.getBean(GaeSearchRepository.class);

    repository.save(new SearchData(1L, 10, "Baz"));
}
 
開發者ID:snowdrop,項目名稱:spring-data-snowdrop,代碼行數:10,代碼來源:SearchTest.java

示例4: testSpringAutoStartupTrue

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
@Test
public void testSpringAutoStartupTrue() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfigAutoStartupTrue.class);
    ctx.start();

    try {
        Engine engine = ctx.getBean(Engine.class);

        assertTrue(engine.isRunning());
        assertFalse(engine.isError());
    } finally {
        ctx.close();
    }
}
 
開發者ID:softelnet,項目名稱:sponge,代碼行數:15,代碼來源:SpringAutoStartupTest.java

示例5: testSpringAutoStartupFalse

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
@Test
public void testSpringAutoStartupFalse() throws InterruptedException {
    AnnotationConfigApplicationContext ctx = new AnnotationConfigApplicationContext(TestConfigAutoStartupFalse.class);
    ctx.start();

    try {
        Engine engine = ctx.getBean(Engine.class);

        assertFalse(engine.isRunning());
        assertFalse(engine.isError());
    } finally {
        ctx.close();
    }
}
 
開發者ID:softelnet,項目名稱:sponge,代碼行數:15,代碼來源:SpringAutoStartupTest.java

示例6: setupContext

import org.springframework.context.annotation.AnnotationConfigApplicationContext; //導入方法依賴的package包/類
@SneakyThrows
public static void setupContext(Class<?>... classes) {
    DatabaseTestContext.setupContext(System.getProperty("database"));

    setProperty("no.nav.modig.security.sts.url", "111111");
    setProperty("no.nav.modig.security.systemuser.username", "username");
    setProperty("no.nav.modig.security.systemuser.password", "password");

    annotationConfigApplicationContext = new AnnotationConfigApplicationContext(classes);
    annotationConfigApplicationContext.start();
    platformTransactionManager = getBean(PlatformTransactionManager.class);

    MigrationUtils.createTables(getBean(DataSource.class));
}
 
開發者ID:navikt,項目名稱:fo-veilarbjobbsokerkompetanse,代碼行數:15,代碼來源:AbstractIntegrasjonsTest.java


注:本文中的org.springframework.context.annotation.AnnotationConfigApplicationContext.start方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。