基于全注解方式的SSH基础框架
说明:文章内容仅供预览,部分内容可能不全,需要完整文档或者需要复制内容,请下载word后使用。下载word有问题请添加微信号:xxxxxxx或QQ:xxxxxx 处理(尽可能给您提供完整文档),感谢您的支持与谅解。
这是我为新项目专门搭建的基于全注解方式的SSH基础框架,虽然是老掉牙的的东西,自我感觉很良好,好东西不敢独享,晒晒
概述:基于struts2.23 + spring2.5.6 + hibernate3.6.4 + hibernate-generic-dao1.0(除了spring,我整合的都是最新的GA包,hibernate-generic-dao是google项目库中一个开源的basedao,我灰常喜欢,因为我找不到更好更适合我的)
项目代码是基于eclipse3.6创建的,很简单,大家直接导入则可运行。
1.包结构,源码,测试用例,配置文件一目了然。每个功能模块都在modules包下做开发,配置文件统一在resource管理(基实也没多少配置文件,都用注解嘛)。
2.无论阅读哪个web项目代码,我都是先从web.xml开始,项目有什么东西一清二楚。
我这里将log4j监听放在第一,我想他应该能够从系统启动开启就能记录我的所有日志(求认证)。第二个监听是proxool数据库连接池,听说很高效,所以果断引入(引入步骤搞得复杂吧,我还重写了监听。一切为了稳定,也好扩展我某日喜欢加入动态切换数据源做准备。呵呵)。OpenSessionInView,我想如果你不喜欢可以摘掉,反正我很喜欢。Struts2指定了自定义的struts.xml文件位置,指定扫描注解的action路径。最后是proxool的可视化图形监控,很棒。
xmlns:web=\ xsi:schemaLocation=\http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd\ id=\ framework log4jConfigLocation /WEB-INF/classes/resources/log4j/log4j.properties propertyFile /WEB-INF/classes/resources/hibernate/proxool.properties contextConfigLocation classpath:resources/spring/applicationContext.xml org.springframework.web.util.Log4jConfigListener
org.chinasb.framework.core.db.ProxoolListener OpenSessionInViewFilter org.springframework.orm.hibernate3.support.OpenSessionInViewFilter singleSession true OpenSessionInViewFilter /* org.springframework.web.context.ContextLoaderListener
Set Character Encoding
org.springframework.web.filter.CharacterEncodingFilter
encoding UTF-8
forceEncoding
true
Set Character Encoding
/* struts-cleanup org.apache.struts2.dispatcher.ActionContextCleanUp struts-cleanup /* struts2 org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter config struts-default.xml,struts-plugin.xml,resources/struts/struts.xml actionPackages org.chinasb.framework.modules struts2 /* Admin org.logicalcobwebs.proxool.admin.servlet.AdminServlet Admin
基于全注解方式的SSH基础框架.doc
将本文的Word文档下载到电脑,方便复制、编辑、收藏和打印