本文整理汇总了Java中org.springframework.context.ConfigurableApplicationContext.close方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigurableApplicationContext.close方法的具体用法?Java ConfigurableApplicationContext.close怎么用?Java ConfigurableApplicationContext.close使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.context.ConfigurableApplicationContext
的用法示例。
在下文中一共展示了ConfigurableApplicationContext.close方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static void main (String[] args){
ConfigurableApplicationContext ac =
new ClassPathXmlApplicationContext("/context.xml");
PollableChannel feedChannel = ac.getBean("feedChannel", PollableChannel.class);
for (int i = 0; i < 10; i++) {
Message<SyndEntry> message = (Message<SyndEntry>) feedChannel.receive(1000);
if (message != null){
System.out.println("==========="+i+"===========");
SyndEntry entry = message.getPayload();
System.out.println(entry.getAuthor());
System.out.println(entry.getPublishedDate());
System.out.println(entry.getTitle());
System.out.println(entry.getUri());
System.out.println(entry.getLink());
System.out.println("======================");
}
}
ac.close();
}
示例2: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
/**
* Create a bunch of files and folders in a folder and then run multi-threaded directory
* listings against it.
*
* @param args <x> <y> where 'x' is the number of files in a folder and 'y' is the
* number of threads to list
*/
public static void main(String ... args)
{
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
try
{
run(ctx, args);
}
catch (Throwable e)
{
System.out.println("Failed to run FileFolder performance test");
e.printStackTrace();
}
finally
{
ctx.close();
}
}
示例3: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
/**
* Create a folder hierarchy and start FixedAclUpdater. See {@link #getUsage()} for usage parameters
*/
public static void main(String... args)
{
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) ApplicationContextHelper.getApplicationContext();
try
{
run(ctx, args);
}
catch (Exception e)
{
System.out.println("Failed to run FixedAclUpdaterTest test");
e.printStackTrace();
}
finally
{
ctx.close();
}
}
示例4: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext context = SpringApplication.run(AemOrchestrator.class, args);
//Need to wait for Author ELB is be in a healthy state before reading messages from the SQS queue
ResourceReadyChecker resourceReadyChecker = context.getBean(ResourceReadyChecker.class);
boolean isStartupOk = false;
if(resourceReadyChecker.isResourcesReady()) {
OrchestratorMessageListener messageReceiver = context.getBean(OrchestratorMessageListener.class);
try {
messageReceiver.start();
isStartupOk = true;
} catch (Exception e) {
logger.error("Failed to start message receiver", e);
}
}
if(isStartupOk) {
logger.info("AEM Orchestrator started");
} else {
logger.info("Failed to start AEM Orchestrator");
context.close(); //Exit the application
}
}
示例5: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args)
{
ConfigurableApplicationContext context = new AnnotationConfigApplicationContext("hei2017.config");
/*
SprintService sprintService = context.getBean(SprintService.class);
Sprint sprintTest = new Sprint();
sprintTest.setNom("test sprint");
sprintService.saveSprint(sprintTest);
*/
context.close();
}
示例6: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) throws InterruptedException {
ConfigurableApplicationContext ctx = SpringApplication.run(SpringIntegrationApplication.class, args);
TempConverter converter = ctx.getBean(TempConverter.class);
for (int i = 0; i < 1000; i++) {
System.out.println(converter.fahrenheitToCelcius(68.0f));
Thread.sleep(10);
}
ctx.close();
}
示例7: startServer
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
@Test
public void startServer() throws Exception {
ConfigurableApplicationContext context = Application.run(new String[]{"--server.port=" + DEMO_PORT});
System.setProperty("demo.server.port", DEMO_PORT + "");
monitor = new MonitorThread(DEMO_PORT + 1, new Stoppable() {
@Override
public void stop() throws Exception {
context.close();
}
});
monitor.start();
monitor.join();
}
示例8: testProxy
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public void testProxy() throws Exception {
// publish service
bundleContext.registerService(new String[] { DataSource.class.getName(), Comparator.class.getName(),
InitializingBean.class.getName(), Constants.class.getName() }, new Service(), new Hashtable());
ConfigurableApplicationContext ctx = getNestedContext();
assertNotNull(ctx);
Object proxy = ctx.getBean("service");
assertNotNull(proxy);
assertTrue(proxy instanceof DataSource);
assertTrue(proxy instanceof Comparator);
assertTrue(proxy instanceof Constants);
assertTrue(proxy instanceof InitializingBean);
ctx.close();
}
示例9: setDirty
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
/**
* Mark the context with the given key as dirty. This will cause the cached
* context to be reloaded before the next test case is executed.
* <p>Call this method only if you change the state of a singleton bean,
* potentially affecting future tests.
*/
protected final void setDirty(Object contextKey) {
String keyString = contextKeyString(contextKey);
ConfigurableApplicationContext ctx = contextKeyToContextMap.remove(keyString);
if (ctx != null) {
ctx.close();
}
}
示例10: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main( String[] args )
{
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("Employee.xml");
context.getBean("employee");
// System.out.println( "Hello World!" );
context.close();
}
示例11: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
/**
* Main method.
*
* @param args list
*/
public static void main(String[] args) {
try {
final ConfigurableApplicationContext applicationContext = SpringApplication.run(ProcessMigrationToolApplication.class, args);
applicationContext.close();
} catch (Exception e) { //NOCHECKSTYLE allow central catch for logging
LOG.error("Migration error", e);
LOG.info("Migration aborted!");
//DO NOT REMOVE! Exception must be thrown to indicate CI Tool (e.g. Jenkins), that the application did not return with RETURN_CODE 0!
throw e;
}
}
示例12: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
ConfigurableApplicationContext context = SpringApplication.run(DubboClientApplication.class, args);
DateConsumerService dateConsumerService = context.getBean(DateConsumerService.class);
System.out.println(dateConsumerService.now());
System.out.println(dateConsumerService.createTime());
context.close();
}
示例13: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
ConfigurableApplicationContext ctx = SpringApplication.run(JsonApp.class, args);
ctx.getBean(JsonApp.class).runDemo();
ctx.close();
}
示例14: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args){
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("Worker.xml");
context.getBean("worker");
context.close();
}
示例15: main
import org.springframework.context.ConfigurableApplicationContext; //导入方法依赖的package包/类
public static void main(String[] args) {
// on prépare la configuration
SpringApplication app = new SpringApplication(DomainAndPersitenceConfigAuto.class);
//Suppression des logs de démarrage de l'application
app.setLogStartupInfo(false);
// on la lance
ConfigurableApplicationContext context = app.run(args);
// métier, appelle de l'interface et nom de l'implementation
IServiceToDoList serviceToDoList = context.getBean(IServiceToDoList.class);
try {
//Creation d'une liste depuis le service
List<ToDoList> toDoLists = serviceToDoList.getAll();
//On affiche dans la console la liste
if (!toDoLists.isEmpty()) {
display("Liste des tâches", toDoLists);
} else {
System.out.println("La bdd est vide");
}
//ajouter tâche
// System.out.println("Ajout d'une tache");
serviceToDoList.createTask(new ToDoList("createTask"));
//suppression
ToDoList doList = serviceToDoList.getAll().get(0);
serviceToDoList.deleteTask(doList);
//mise à jour
doList = serviceToDoList.getAll().get(0);
doList.setLibelle("updateTask");
serviceToDoList.updateTask(doList);
display("Liste des tâches", serviceToDoList.getAll());
} catch (Exception ex) {
System.out.println("Exception : " + ex.getCause());
}
// fermeture du contexte Spring
context.close();
}