Rez*_*bri 11
用这个:
String contextXML = ...;
Resource resource = new ByteArrayResource(contextXML.getBytes());
GenericXmlApplicationContext springContext = new GenericXmlApplicationContext();
springContext.load(resource);
Object myBean = springContext.getBean("myBean");
...
Run Code Online (Sandbox Code Playgroud)
雷扎
我找到了一种方法。
public MyApplicationContext(String xml,
ApplicationContext parent){
super(parent);
this.configResources = new Resource[1];
configResources[0] = new ByteArrayResource(xml.getBytes());
refresh();
}
private Resource[] configResources;
protected Resource[] getConfigResources() {
return this.configResources;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5156 次 |
| 最近记录: |