⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 servicelocal.java

📁 struts+hibernate+spring框架实现
💻 JAVA
字号:
package com.cvicse.myssh.spring.service;

import org.springframework.context.ApplicationContext;


public class ServiceLocal  {

	 /**
     * ApplicationContext.
     */
    private static ApplicationContext context;

    /**
     * @return 返回 context。
     */
    protected static ApplicationContext getContext() {
        return ServiceLocal.context;
    }

    /**
     * @param cntext
     *            要修改的 context。
     */
    protected static void setContext(final ApplicationContext cntext) {
    	ServiceLocal.context = cntext;
    }

    /**
     * Creates new ServiceLocator object.
     */
    private ServiceLocal() {
    }

    /**
     * get manager service.
     * @param service
     *            service name
     * @return manager service
     */
    public static Object getService(final String service) {
    	System.out.println(context);
        return context.getBean(service);
    }
}

⌨️ 快捷键说明

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