2017.4.28 SSM框架搭建与配置
2017-04-28 13:50
295 查看
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框架搭建与配置
- 使用idea搭建一个简单的SSM框架:(2)配置springMVC
- SSM框架搭建(四) springmvc和mybatis的配置
- 搭建ssm框架项目基本原理和主要的配置文件小结
- 搭建SSM框架的几大综合配置文件
- 使用idea搭建一个简单的SSM框架:(3)配置spring+mybatis
- ssm框架搭建出错,classes文件夹下没有编译我的配置文件
- Spring+SpringMVC+Mybatis(SSM)框架搭建教程(三)-配置文件详解
- SSM框架搭建中的相关配置
- 搭建ssm框架项目基本原理和主要的配置文件小结
- 快速搭建springboot框架以及整合ssm+shiro+安装Rabbitmq和Erlang、Mysql下载与配置
- SSM基于注解配置Spring4.1.6、springMVC4.1.6、mybatis3.2.8的maven框架搭建
- 从零开发校园商铺平台(SSM到SpringBoot)二.SSM框架搭建(配置与验证)
- SSM(Spring+Spring MVC+Mybatis)环境框架搭建与配置详解
- 使用IDEA配置Maven搭建开发框架ssm教程
- 搭建ssm框架项目基本原理和主要的配置文件小结
- ssm框架的搭建配置文件
- 使用SSM框架搭建web项目配置步骤
- maven搭建ssm框架之spring容器(applicationContext.xml)配置
- IDEA搭建SSM框架 以及环境配置