解决方法
用这个:
String contextXML = ...; Resource resource = new ByteArrayResource(contextXML.getBytes()); GenericXmlApplicationContext springContext = new GenericXmlApplicationContext(); springContext.load(resource); Object myBean = springContext.getBean("myBean"); ...
雷扎