zoukankan      html  css  js  c++  java
  • spring beans的写入工具——spring-beans-writer

    spring-beans-writer是我曾经为动态生成spring beans配置文件做的一个写入工具,托管地址:

    https://github.com/bluejoe2008/spring-beans-writer


    绝对原创,支持国人开源!


    如下附上项目简单说明,抱歉原文是英文的,后面会能弄出中文版:)



    spring-beans-writer

    writer for spring IOC beans files

    it is too easy to use, please see the test case:

    https://github.com/bluejoe2008/spring-beans-writer/blob/master/test/cn/bluejoe/SpringBeansTest.java

    example codes:

        SpringBeans beans = new SpringBeans();
        beans.addBean(_database, "database");
        beans.addBeans(_persons);
    
        SpringBeansWriter sbw = new SpringBeansWriter();
        List<FilteredOutput> outputs = new ArrayList<FilteredOutput>();
        outputs.add(new SimpleFilteredOutput(new File("spring_beans.xml")));
        sbw.write(beans, outputs);
    

    you can let spring-beans-writer save beans into multiple files:

        List<FilteredOutput> outputs = new ArrayList<FilteredOutput>();
        //write tables into a spring_persons.xml
        outputs.add(new SimpleFilteredOutput(new Matcher<EntityNode<?>>()
        {
            @Override
            public boolean matches(EntityNode<?> x)
            {
                return x.getValue().getClass() == Person.class;
            }
        }, new File("spring_persons.xml")));
    
        outputs.add(new SimpleFilteredOutput(new File("spring_databases.xml")));
        sbw.write(beans, outputs);
    

    on default, only annotated properties of a JavaBean will be written into output files. To annotate a JavaBean property, use '@XmlProperty':

    @XmlProperty
    public void setName(String name)
    {
        _name = name;
    }
    

    you can let spring-beans-writer write all JavaBean properties:

    SpringBeansWriter sbw = new SpringBeansWriter(new DumpAllProperties());
    

    acknowledgements

    special thanks to suxianming@gmail.com, the guy who have ever worked on the project with me.

  • 相关阅读:
    模式识别 之 BP算法
    仪器开发 之 DICOM 三维重建 HPP
    模式识别 之 BP算法 (二)
    病理分析 之 细胞分析
    脉搏血氧仪 之 算法原理
    模式识别 之 初学
    机器学习 之 模糊神经(失败总结)
    冲刺第二天
    冲刺第三天
    团队项目计划
  • 原文地址:https://www.cnblogs.com/bluejoe/p/5115954.html
Copyright © 2011-2022 走看看