DEV Community

Query Filter
Query Filter

Posted on

docker134

private void init(String applicationFullName) throws Exception, SAXException, IOException, FileNotFoundException {
    com.citigroup.get.quantum.config.v2.Property prop1 = new PropertyImpl("beans.DOCTYPE.publicId", (Date)null, "-//SPRING//DTD BEAN//EN");
    com.citigroup.get.quantum.config.v2.Property prop2 = new PropertyImpl("beans.DOCTYPE.systemId", (Date)null, "http://www.springframework.org/dtd/spring-beans.dtd");
    com.citigroup.get.quantum.config.v2.Property prop3 = new PropertyImpl("beans", (Date)null, "ELEMENT");
    com.citigroup.get.quantum.config.v2.Property prop4 = new PropertyImpl("beans.COMMENT[0]", (Date)null, "Definitions for all Entity Beans");

    this.initPropList.add(prop1);
    this.initPropList.add(prop2);
    this.initPropList.add(prop3);
    this.initPropList.add(prop4);

    XMLGenerator gen = new XMLGenerator();
    ByteArrayOutputStream baos = new ByteArrayOutputStream(this.initPropList.size() * 10);
    gen.convertProps2XML("beans", this.initPropList, baos);

    File tempFile = File.createTempFile("conf_" + applicationFullName + "_", ".xml");
    this.logger.info("saved to temp file " + tempFile);

    try (FileOutputStream fos = new FileOutputStream(tempFile)) {
        baos.writeTo(fos);
    }

    this.beanFactory = new DefaultListableBeanFactory();
    new XmlBeanDefinitionReader((DefaultListableBeanFactory) this.beanFactory).loadBeanDefinitions(new ByteArrayResource(baos.toByteArray()));

    this.logger.info("Spring context " + this.beanFactory);
}
Enter fullscreen mode Exit fullscreen mode

Top comments (0)