logjobmethodbeantest.java

来自「《精通Spring》源代码」· Java 代码 · 共 47 行

JAVA
47
字号
/*
 * Created on 2004-11-14
 *
 * http://www.open-v.com 提供代码的维护工作
 */
package com.openv.spring;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

import org.quartz.Scheduler;
import org.quartz.SchedulerException;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;

import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;


/**
 * LogJobMethodBean客户应用
 *
 * @author luoshifei
 */
public class LogJobMethodBeanTest {
    protected static final Log log = LogFactory.getLog(LogJobMethodBeanTest.class);

    public static void main(String[] args) {
        Resource resource = new ClassPathResource("appcontextmethod.xml");
        BeanFactory factory = new XmlBeanFactory(resource);
        Scheduler sfb = (Scheduler) factory.getBean("sfb");

        try {
            Thread.sleep(20000);
        } catch (InterruptedException e) {
            log.error("InterruptedException", e);
        }

        try {
            sfb.shutdown();
        } catch (SchedulerException se) {
            log.error("SchedulerException", se);
        }
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?