当前位置: 首页>>代码示例>>Java>>正文


Java ConfigurableApplicationContext.close方法代码示例

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


}
 
开发者ID:paulossjunior,项目名称:spring_integration_examples,代码行数:26,代码来源:Application.java

示例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();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:26,代码来源:FileFolderPerformanceTester.java

示例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();
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:21,代码来源:FixedAclUpdaterTest.java

示例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
    }
}
 
开发者ID:shinesolutions,项目名称:aem-orchestrator,代码行数:27,代码来源:AemOrchestrator.java

示例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();
}
 
开发者ID:scrumtracker,项目名称:scrumtracker2017,代码行数:14,代码来源:Application.java

示例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();
}
 
开发者ID:micrometer-metrics,项目名称:micrometer,代码行数:12,代码来源:SpringIntegrationApplication.java

示例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();
}
 
开发者ID:intuit,项目名称:karate,代码行数:14,代码来源:DemoStart.java

示例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();
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:16,代码来源:NonOSGiLoaderProxyTest.java

示例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();
	}
}
 
开发者ID:eclipse,项目名称:gemini.blueprint,代码行数:14,代码来源:AbstractSpringContextTests.java

示例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();
    }
 
开发者ID:garyhu1,项目名称:spring_mvc_demo,代码行数:8,代码来源:App.java

示例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;
    }
}
 
开发者ID:satspeedy,项目名称:camunda-migrator,代码行数:17,代码来源:ProcessMigrationToolApplication.java

示例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();
}
 
开发者ID:wyp0596,项目名称:elegant-springboot,代码行数:8,代码来源:DubboClientApplication.java

示例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();
}
 
开发者ID:laidu,项目名称:java-learn,代码行数:6,代码来源:Application.java

示例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();
}
 
开发者ID:garyhu1,项目名称:spring_mvc_demo,代码行数:6,代码来源:TestAnnotion.java

示例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();
	}
 
开发者ID:Julien35,项目名称:dev-courses,代码行数:44,代码来源:BootIServiceToDoList.java


注:本文中的org.springframework.context.ConfigurableApplicationContext.close方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。