spring.java

来自「java pos,你可以直接编译运行,」· Java 代码 · 共 56 行

JAVA
56
字号
/* * Copyright (c) 2004 jPOS.org * * See terms of license at http://jpos.org/license.html * */package org.jpos.q2.spring;import org.jpos.q2.QBeanSupport;import org.jpos.core.ConfigurationException;import org.springframework.context.support.FileSystemXmlApplicationContext;import org.springframework.context.ApplicationContext;import org.jpos.util.NameRegistrar;/** * @author Anthony Schexnaildre * @version $Revision: 1.2 $ $Date: 2004/11/23 18:21:01 $ * @jmx:mbean description="Spring QBean" extends="org.jpos.q2.QBeanSupportMBean" */public class Spring extends QBeanSupport implements SpringMBean {    ApplicationContext context;    String[] configFiles;    public void initService () throws ConfigurationException {        configFiles = cfg.getAll( "config" );         if ( configFiles.length < 1 )            throw new ConfigurationException ("config property not specified");        context = new FileSystemXmlApplicationContext( configFiles );    }    public void startService () {        NameRegistrar.register( getName(), this );    }    public void stopService () {        NameRegistrar.unregister( getName() );    }    /**     * Returns the Spring ApplicationContext     */    public ApplicationContext getContext () {	    return context;    }    /**     * @jmx:managed-attribute description="Configuration Files"     */    public String[] getConfig () {        return configFiles;    }}

⌨️ 快捷键说明

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