Watch Star Fork

白乔 / spring-beans-writerJava

用程序自动创建spring beans的配置文件,欢迎一起完善!
Zhihong SHEN 最后提交于 2017-10-31 19:49 Delete
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading... 1.89 KB



writer for spring IOC beans files

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

import spring-beans-writer:

<!-- -->

example codes:

	SpringBeans beans = new SpringBeans();
	beans.addBean(_database, "database");

	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 require 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<?>>()
		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':

public void setName(String name)
	_name = name;

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

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


special thanks to, the guy who have ever worked on the project with me.

项目点评 ( 1 )


7_float_left_people 7_float_left_close