如下@service标注的类 @Service public class EsIndexForPackageJobHandler extends IJobHandler {
} 使用main方法去获取service public static void main(String[] args) { ApplicationContext ac = new ClassPathXmlApplicationContext("classpath*:applicationcontext*.xml"); EsIndexForPackageJobHandler esIndexForPackageJobHandler = ac.getBean(EsIndexForPackageJobHandler.class); try { esIndexForPackageJobHandler.execute("11"); } catch (Exception e) { e.printStackTrace(); } }