# spring-beans-writer
**Repository Path**: bluejoe/spring-beans-writer
## Basic Information
- **Project Name**: spring-beans-writer
- **Description**: 用程序自动创建spring beans的配置文件,欢迎一起完善!
- **Primary Language**: Java
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 14
- **Forks**: 2
- **Created**: 2017-10-15
- **Last Updated**: 2022-02-21
## Categories & Tags
**Categories**: code-generator
**Tags**: None
## README
中文版:https://github.com/bluejoe2008/spring-beans-writer/blob/master/README_CN.md
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
import spring-beans-writer:
com.github.bluejoe2008
spring-beans-writer
0.9
example codes:
SpringBeans beans = new SpringBeans();
beans.addBean(_database, "database");
beans.addBeans(_persons);
SpringBeansWriter sbw = new SpringBeansWriter();
List outputs = new ArrayList();
outputs.add(new SimpleFilteredOutput(new File("spring_beans.xml")));
sbw.write(beans, outputs);
you can require spring-beans-writer save beans into multiple files:
List outputs = new ArrayList();
//write tables into a spring_persons.xml
outputs.add(new SimpleFilteredOutput(new Matcher>()
{
@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.