本文整理匯總了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();
}
}
示例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();
}
示例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"));
}
示例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();
}
}
示例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();
}
}
示例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));
}