ImageVerifierCode 换一换
格式:DOCX , 页数:24 ,大小:153.66KB ,
资源ID:16413044      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/16413044.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(SpringMvc+Mybatis+Redis框架Word文档下载推荐.docx)为本站会员(b****4)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

SpringMvc+Mybatis+Redis框架Word文档下载推荐.docx

1、redis:这里重写了spring-data-redis里面的RedisCache、RedisCachemanager两个类和封装了一些其他的类目的就是为了实现redis的自动续期和单用户登录功能(一个用户同时只能在一个地方登录)如果需要实现不同平台的单用户登录需要自己小改一下 在缓存中多加个平台标识就行了butler:这是web项目 名字不必纠结 介绍下包的作用org.service:系统的一些服务类 这里只有定时任务(Spring Task)和Spring Mail邮件推送服务org.system:这个看里面的包就知道干嘛用的了 就说说exception和interception这两个or

2、g.system.exception:全局异常处理 这里把所有的程序异常捕捉并用JSON返回,以免其他客户端在服务器报错时出现一些数据无法解析造成的其他问题。至于项目的异常自己也做了配置和封装,在报错的时候可以异步发送邮件给管理员,具体实现请继续往下看框架的大致结构就介绍到这里 下面说一下配置的xml 有人说多 其实还还好,不喜欢多的可以合一下,两个就能解决了,我分开是为了更明显的区分web.xmlhtml view plain copy 在CODE上查看代码片派生到我的代码片 web-app xmlns:xsi=http:/www.w3.org/2001/XMLSchema-instance

3、 xmlns=/xmlns.jcp.org/xml/ns/javaee xsi:schemaLocation=/xmlns.jcp.org/xml/ns/javaee http:/xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd version=3.1 butler!- 声明Spring配置文件所在目录 -context-paramparam-namecontextConfigLocationparam-value classpath*:applicationContext.xml, spring-*.xml /param-value/context-pa

4、ram- 声明IntrospectorCleanupListener监听器防止反复加载对象造成内存泄漏 -listenerlistener-classorg.springframework.web.util.IntrospectorCleanupListener/listener- 声明ContextLoaderListener监听器自动装配Spring配置文件信息 -org.springframework.web.context.ContextLoaderListenerfilterfilter-nameCharacterEncodingfilter-classorg.springframe

5、work.web.filter.CharacterEncodingFilterinit-paramencodingUTF-8/filterfilter-mappingurl-pattern/*/filter-mapping- 配置Spring控制器 -servletservlet-namespringservlet-classorg.springframework.web.servlet.DispatcherServletclasspath*:spring-mvc.xml1/servlet- HttpPutFormContentFilter 使put方法是也可以获取表单内的参数 这里我有特殊需

6、求标准的Rest可以去掉-HttpMethodFilterorg.springframework.web.filter.HttpPutFormContentFilter/servlet-mapping/web-app接下来是Spring的主配置文件applicationContext.xmlutf-8beans xmlns=/www.springframework.org/schema/beans xmlns:context=/www.springframework.org/schema/contextaop=/www.springframework.org/schema/aoptx=/www

7、.springframework.org/schema/txcache=/www.springframework.org/schema/cachec=/www.springframework.org/schema/c/www.springframework.org/schema/beans http:/www.springframework.org/schema/beans/spring-beans.xsd /www.springframework.org/schema/context /www.springframework.org/schema/context/spring-context

8、.xsd /www.springframework.org/schema/aop /www.springframework.org/schema/aop/spring-aop.xsd /www.springframework.org/schema/tx /www.springframework.org/schema/tx/spring-tx.xsd /www.springframework.org/schema/cache /www.springframework.org/schema/cache/spring-cache-3.2.xsd- 配置需要交给spring扫描管理的包,一般是包括整个

9、项目的java文件的父包(由context提供) -context:component-scan base-package=org.system,org.service.task /- 属性文件读入,用于加密数据库配置文件 -bean id=propertyConfigurer class=org.system.encrypt.DBConfigurerproperty name=locationslistvalueclasspath:conf.properties/list/property/bean- 配置需要交给spring扫描管理的文件,一般是项目的配置文件(由context提供) -p

10、roperty-placeholder location=conf.properties- 配置数据源 -bean name=dataSourcecom.alibaba.druid.pool.DruidDataSource destroy-method=close- 基本配置 -driverClassName value=$db.driverClassNameurl$db.urlusername$db.userpassword$db.password- 初始化时建立物理连接的个数 -initialSize$db.initialSize- 最小连接池数 -minIdle$db.minIdle-

11、最大连接池数量 -maxActive$db.maxActive- 配置获取连接等待超时的时间 -maxWait$db.maxWait- 配置sqlSessionFactory(由mybatis-spring.jar提供支持) -sqlSessionFactoryorg.mybatis.spring.SqlSessionFactoryBean ref=- 配置mybatis的默认选项 -configuration- 配置拦截器用于Mybatis分页和总数查询,只实现Mysql 其他的可以参照 -pluginsPaginationInterceptor- mybatis默认选项配置 这里是因为我返

12、回全是用Map所以如果数据库有字段为空就会使这个属性不显示 为了解决这个问题才需要配置这个-org.apache.ibatis.session.ConfigurationcallSettersOnNullstrue/- Mybatis分页拦截器 -org.system.intercept.PaginationInterceptor- Mapper接口所在包名,Spring会自动查找其下的Mapper -bean class=org.mybatis.spring.mapper.MapperScannerConfigurerbasePackageorg.system.mapper.*sqlSess

13、ionFactoryBeanName- 支持注解事务模式 -tx:annotation-driven transaction-manager=transactionManager proxy-target-class=- 事务管理 -org.springframework.jdbc.datasource.DataSourceTransactionManager- 配置声明式事务 -advice id=txAdvice transaction-manager=attributesmethod name=insert* propagation=REQUIRED read-only=falsedel

14、ete*update*get*SUPPORTS/tx:advice- 配置该声明式事务规则用于的切入点 步骤: 1.配置切入点 2.应用该声明式事务规则 -aop:config proxy-target-class= expose-proxy=- 配置切入点 -pointcut id=transaction_pointcut expression=execution(* org.system.service.impl.*.*(.)- 应用该声明式事务规则 -advisor advice-ref= pointcut-ref=/aop:config- 异常拦截器 -exceptionHandler

15、org.system.exception.ExceptionResolver- Spring上下文工具类 -springContextUtilorg.service.utils.spring.SpringContextUtil/beans这里说一说有个数据库加密的东西在这里意思就是用DBConfigurer这个类来解密conf.properties这个文件内的几个配置 就是采用了DES加密解密主要为了防止配置文件泄露数据库的信息暴露 如果不用直接注释掉就可以使用明文了 稍后会把properties相关文件贴出来接下来是spring-mvc.xmlmvc=/www.springframework

16、.org/schema/mvctask=/www.springframework.org/schema/task/www.springframework.org/schema/beans http:/www.springframework.org/schema/mvc http:/www.springframework.org/schema/mvc/spring-mvc.xsd /www.springframework.org/schema/aop http:/www.springframework.org/schema/context http:/www.springframework.or

17、g/schema/task http:/www.springframework.org/schema/task/spring-task-3.1.xsd - 扫描要自动管理的包 -org.system.controller.impl- 静态资源文件路径设置 -mvc:resources location=/api/ mapping=/api/*- 对模型视图名称的解析,在请求时模型视图名称添加前后缀 系统内没有涉及到页面跳转所以基本无用-org.springframework.web.servlet.view.InternalResourceViewResolverprefix/suffix va

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1