本文整理汇总了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));
}