再说spring比较重,臃肿的看此文!!!!!

 

springrain地址:http://git.oschina.net/chunanyong/springrainhtml

spring的强大灵活+jfinal的开发效率!git

个人博客:http://www.weicms.net/2012/12/14/spring_super.htmlspring

 

在ssh中,我认为spring是惟一值得用的框架数据库

spring mvc 的优势能够自行在网络搜索,特别是3.0以后......我不认为spring 的controller会比其余的差!!!!网络

spring的良好的扩展性,集成度,IOC,AOP事务,已是项目的基础条件mvc

我实在没法忍受各类软文说spring 太厚重,臃肿了.如下代码是个人测试用例.我还真是没明白,spring复杂到哪了!!!app

controller service  dao Entity 都使用注解,就极简而言,一个数据库只须要一个Dao,一个Service 而已!!!框架

//就极简而言,一个数据库只须要一个Service,就能够查询这个数据库的任意一张表
//@Test 返回一个基本类型
public void testObject() throws Exception{
	Finder finder=new Finder("select id from [Users] where 1=1 ");
	finder.append("and userId=:userId").setParam("userId", 125);
Integer id = baseFangService.queryForObject(finder, Integer.class);
System.out.println(id);

}


//@Test 返回一个Entity
public void testObjectUser() throws Exception{
	Finder finder=new Finder("select * from Users where id=125 order by id");
	Users u = baseFangService.queryForObject(finder, Users.class);
    System.out.println(u.getName());

}
//@Test 调用存储过程并返回 Map
public void testProc() throws Exception{
	Finder finder=new Finder();
	finder.setParam("unitId", 0);
	finder.setProcName("proc_myproc");
	Map queryObjectByProc = (Map) baseFangService.queryObjectByProc(finder);
	System.out.println(queryObjectByProc.get("#update-count-10"));
	
}
//@Test 调用数据库函数,并返回结果
public void testFunction() throws Exception{
	Finder finder=new Finder();
	
	finder.setFunName("fun_userId");
	finder.setParam("userId", 125);
	String userName= baseFangService.queryForObjectByByFunction(finder,String.class);
	System.out.println(userName);
	

}

//@Test  保存一个对象
public void testRoleModel() throws Exception{
		Re_Role_Model re=new Re_Role_Model();
		re.setRoleId("user");
		re.setBool(1);
		baseFangService.save(re);
	
	
}
相关文章
相关标签/搜索