springrain地址:http://git.oschina.net/chunanyong/springrain
spring的强大灵活+jfinal的开发效率!
我的博客:http://www.weicms.net/2012/12/14/spring_super.html
在ssh中,我认为spring是唯一值得用的框架
spring mvc 的优点可以自行在网络搜索,特别是3.0之后......我不认为spring 的controller会比其他的差!!!!
spring的良好的扩展性,集成度,IOC,AOP事务,已经是项目的基础条件
我实在无法忍受各种软文说spring 太厚重,臃肿了.以下代码是我的测试用例.我还真是没明白,spring复杂到哪了!!!
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);
}