2017.4.28 SSM框架搭建与配置
1.项目结构
2.配置文件
对配置文件进行总结:
pom.xml
web.xml
-> 配置web相关
-> 读取application*.xml
5 -> 读取logback.xml
applicationContext.xml
->配置spring的主要信息
->读取sqlMapConfig.xml
->读取mapper.xml
->读取ehcache.xml
sqlMapConfig.xml
->配置mybatis相关
mapper.xml
->mybatis的映射文件
ehcache.xml
->配置ehcache相关
applicationContext-rms.xml
->配置项目相关
applicationContext-shiro.xml
->配置shiro相关
(1)pom.xml
<!--1 单元测试-->
junit
<!--2 spring相关依赖 为什么没有spring-beans?-->
<!--核心依赖-->
spring-core
spring-context
spring-context-support
<!--web相关-->
spring-web
spring-webmvc
<!--数据库相关-->
spring-jdbc
spring-tx
<!--redis相关-->
spring-data-redis
jedis
<!--3 mybatis-->
mybatis
mybatis-spring
<!--4 日志-->
slf4j-api
logback-classic
<!--5 JSON-->
fastjson
<!--6 数据库-->
<!--连接池-->
druid
<!--驱动-->
mysql-connector-java
postgresql
<!--7 apache工具-->
commons-beanutils
commons-lang
<!--8 shiro相关依赖-->
shiro-core
shiro-web
shiro-aspectj
shiro-spring
shiro-ehcache
shiro-quartz
<!--9 ehcache相关依赖-->
ehcache
<!--10 servlet-->
javax.servlet-api
<!--11 标签库-->
jstl
<!--12 jersey相关依赖-->
jersey-bundle
jersey-spring
<!-- 这里<exclusions>了spring的几个包,为什么?-->
spring-beans,spring-context,spring-core,spring-web,spring-aop
<!--13 不太明白作用的-->
aspectjweaver
javaee-api
(2)web.xml
<!--配置文件读取-->
contextConfigLocation:classpath*:/spring/**/applicationContext*.xml
logbackConfigLocation:file:/usr/local/***/***/conf/logback.xml
<!--监听器-->
LogbackConfigListener
ContextLoaderListener
<!--Servlet-->
RESTServlet
DruidStatView
<!--过滤器-->
CharacterEncodingFilter
<!--shiroFilter-->
DelegatingFilterProxy
(3)applicationContext.xml
<!--配置文件读取-->
<context:property-placeholder location=**/> <!--支持注解-->
<context:annotation-config/> <!--自动扫描的包,过滤被扫描的类-->
<context:component-scan base-package="******">
<context:exclude-filter> ***
<context:include-filter> *** <!--dataSource;sqlSeesionFactory;sqlSessionTemplate-->
<bean id="dataSource">
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
dataSource
typeAliasesPackage
configLocation:classpath:resources/mybatis/sqlMapConfig.xml
mapperLocation: classpath:sql/*.xml
<bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate">
sqlSessionFactory <!--通过自动扫描方式创建mapper bean-->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <!--事务管理-->
<tx:annotation-driven transaction-manager="transactionManager">
<bean id="transactionManager>
dataSource <!--cache-->
<cache:annotation-driven cache-manager="cacheManager" proxy-target-class="false"/>
<bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">
configLocation:classpath:ehcache/ehcache.xml
<bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">
cacheManager:ehcacheManager
(4)application-rms.xml
<!--国际化资源-->
<bean id="messageSource" class="com.baosight.common.message.XinsightResourceBundleMessageSource">
(5)application-shiro.xml
//todo
(6)ehcache.xml
<defaultCache>
<cache name="authorizationCache">
<cache name="authenticationCache">
(7)sqlMapConfig.xml
<configuration>
<!--除去environments节点(datasource和txmanager本来的位置),其他mybatis的属性都可以在这里设置-->
</configuration>
2017.4.28 SSM框架搭建与配置的更多相关文章
- SSM框架搭建web服务器实现登录功能(Spring+SpringMVC+Mybatis)
初学java EE,虽然知道使用框架会使开发更加便捷高效,但是对于初学者来说,感到使用框架比较迷惑,尤其是各种jar包的引用.各种框架的配置.注解的使用等等. 最好的学习方法就是实践,于是下载了一个现 ...
- SpringMVC笔记——SSM框架搭建简单实例
落叶枫桥 博客园 首页 新随笔 联系 订阅 管理 SpringMVC笔记——SSM框架搭建简单实例 简介 Spring+SpringMVC+MyBatis框架(SSM)是比较热门的中小型企业级项目开发 ...
- ssm框架搭建整合测试
下载各种jar包 mybatis下载 https://github.com/mybatis/mybatis-3/releases mysql驱动下载 http://mvnrepository.com/ ...
- SSM 框架搭建
SSM框架搭建(Spring.SpringMVC.Mybatis) 一:基本概念 Spring : Spring是一个开源框架,Spring是于2003 年兴起的一个轻量级的Java 开发框 ...
- 简单的SSM框架搭建教程
简单的ssm框架的搭建和配置文件 ssm框架里边的配置: 1.src路径下直接存放数据库和log4j的properties文件 2.src路径下建个config包,分别放置ssm的xml文件 3.修改 ...
- SSM框架搭建教程(从零开始,图文结合)
1.准备 IntelliJ IDEA Tomcat JDK Maven mysql spring.springmvc.mybatis 了解 现在假设如上条件你都具备,那么通过我这篇博客 你一定可以整合 ...
- 实习小结(二)--- SSM框架搭建
SSM项目框架搭建 前几天做了一个学生信息管理的项目,使用纯控制台输入,查询数据库,将信息在控制台中打印,功能完善得差不多之后,老师让将这个项目移植到Web中,使用Spring+SpringMVC+M ...
- SSM框架搭建详细解析
总结了一下搭建SSM框架流程,在以后用到的时候方便回头使用. 使用工具:MyEclipse 2015:Tomcat 8版本:jdk1.8版本. 首先: 1:创建一个WebProject项目,jdk1. ...
- idea ssm框架搭建
1.分享一篇完整的ssm框架搭建连接 大牛博客:https://www.cnblogs.com/toutou/p/ssm_spring.html#_nav_0 2.我的搭建的完整项目连接,可以进入我的 ...
随机推荐
- 培训补坑(day5:最小生成树+负环判断+差分约束)
补坑补坑((╯‵□′)╯︵┻━┻) 内容真的多... 一个一个来吧. 首先是最小生成树. 先讲一下生成树的定义 生成树就是在一张图上选取一些边,使得整个图上所有的点都连通. 那么我们要求的最小生成树有 ...
- python登陆github
#!/usr/bin/env python # encoding: utf-8 import requests from headers import headers from lxml import ...
- springBoot开启热部署
springBoot开启热部署 这里使用devtools工具开启热部署 〇.搭建springbboot基础环境 一.添加依赖 <dependency> <groupId>org ...
- MySQL学习——基础
本文是MySQL的基础知识. Linux启动MySQL服务命令 : service mysql start Linux关闭MySQL服务命令 : service mysql stop 登录MySQL命 ...
- log4j配置文件动态指定日志文件名称
我们在项目当中经常会使用log4j进行日志记录,偶尔会遇到一些要求,比如日志文件名称按照启动参数动态配置,而不去修改log4j.xml,比较简单的一种做法是,通过设置系统属性的方式实现,代码: if( ...
- QueryDict对象
所在的包: django.http.QueryDict HttpRequest 对象中的 GET 和 POST 属性 都是 QueryDict类型 与python字典不同:QueryDict对象一个键 ...
- 本地添加maven支持
第一步:添加maven支持,去Apache maven官网下载maven, 解压 在conf文件夹里有个settings.xml,这个是需要自己配置的,不然的话也会有默认,只是那样的话会在C盘了,不喜 ...
- POJ1273 Drainage Ditches (网络流)
Drainage Ditches Time Limit: 1000MS Memor ...
- luogu P1072 Hankson的趣味题
题目链接 luogu P1072 Hankson 的趣味题 题解 啊,还是noip的题好做 额,直接推式子就好了 \(gcd(x,a_0)=a_1=gcd(\frac{x}{a_1},\frac{a_ ...
- [BZOJ3237][AHOI2013]连通图(分治并查集)
3237: [Ahoi2013]连通图 Time Limit: 20 Sec Memory Limit: 512 MBSubmit: 1736 Solved: 655[Submit][Status ...