13 Star 14 Fork 2

白乔 / spring-beans-writer

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
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:

<!-- https://mvnrepository.com/artifact/com.github.bluejoe2008/spring-beans-writer -->
<dependency>
    <groupId>com.github.bluejoe2008</groupId>
    <artifactId>spring-beans-writer</artifactId>
    <version>0.9</version>
</dependency>

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 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<?>>()
	{
		@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.

空文件

简介

用程序自动创建spring beans的配置文件,欢迎一起完善! 展开 收起
Java
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
Java
1
https://gitee.com/bluejoe/spring-beans-writer.git
git@gitee.com:bluejoe/spring-beans-writer.git
bluejoe
spring-beans-writer
spring-beans-writer
master

搜索帮助