码迷,mamicode.com
首页 > 移动开发 > 详细

自定义Spring ApplicationContext 支持动态订阅spring配置

时间:2017-04-27 17:57:47      阅读:271      评论:0      收藏:0      [点我收藏+]

标签:extend   apple   return   new   tab   bsp   订阅   ++   loader   

public class StringXmlApplicationContext extends AbstractXmlApplicationContext {

private Resource[] configResources;

 

public StringXmlApplicationContext(String stringXml) {

  this(new String[] { stringXml }, null);

}

 

public StringXmlApplicationContext(String[] stringXmls) {

  this(stringXmls, null);

}

 

public StringXmlApplicationContext(String[] stringXmls, ApplicationContext parent) {

  super(parent);

  this.configResources = new Resource[stringXmls.length];

  for (int i = 0; i < stringXmls.length; i++) {

    this.configResources[i] = new ByteArrayResource(stringXmls[i].getBytes());

  }

  refresh();

}

 

protected Resource[] getConfigResources() {

  return this.configResources;

}

 

public ClassLoader getClassLoader() { 

       return this.getClass().getClassLoader();

    }

}

自定义Spring ApplicationContext 支持动态订阅spring配置

标签:extend   apple   return   new   tab   bsp   订阅   ++   loader   

原文地址:http://www.cnblogs.com/adealjason/p/6775264.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!