浏览代码

配置修改

huangzhiyong 8 年之前
父节点
当前提交
a7319ec51a

+ 1 - 0
hos-core/src/main/java/com/yihu/hos/core/http/DefaultClientImpl.java

@ -199,6 +199,7 @@ class DefaultClientImpl implements HTTPClient {
            return new HTTPResponse(response.code(), response.body().string());
        } catch (IOException ex) {
            ex.printStackTrace();
            log.error(ex.getMessage());
        }

+ 10 - 10
hos-web-framework/src/main/java/com/yihu/hos/web/framework/util/springutil/SpringBeanUtil.java

@ -3,7 +3,6 @@ package com.yihu.hos.web.framework.util.springutil;
import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
/**
 * 服务管理器。服务管理器是所有顶级服务的生成器。若是单元测试使用此服务工厂,Spring Context会被ServiceFactory创建。
@ -28,6 +27,7 @@ public class SpringBeanUtil  {
    public static void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
        springContext = applicationContext;
        System.out.println("springBeanUtil 初始化成功~,springContext is null: "+ (springContext==null));
    }
    public static <T> T getBean(String beanName){
@ -43,15 +43,15 @@ public class SpringBeanUtil  {
     * @return
     */
    public static <T> T getService(String serviceName) {
        if (springContext == null) {
            springContext = new ClassPathXmlApplicationContext(new String[]
                    {
                            "spring/applicationContext.xml"
                    }
            );
        }
        return (T) springContext.getBean(serviceName);
//        if (springContext == null) {
//            springContext = new ClassPathXmlApplicationContext(new String[]
//                    {
//                            "spring/applicationContext.xml"
//                    }
//            );
//        }
        return (T) getApplicationContext().getBean(serviceName);
    }
    /**