zoukankan      html  css  js  c++  java
  • 2017.4.28 SSM框架搭建与配置

    1.项目结构

    2.配置文件

    对配置文件进行总结:

     1 pom.xml  
     2 web.xml 
     3     -> 配置web相关
     4     -> 读取application*.xml
    5 -> 读取logback.xml
    5 applicationContext.xml 6 ->配置spring的主要信息 7 ->读取sqlMapConfig.xml 8 ->读取mapper.xml 9 ->读取ehcache.xml 10 sqlMapConfig.xml 11 ->配置mybatis相关 12 mapper.xml 13 ->mybatis的映射文件 14 ehcache.xml 15 ->配置ehcache相关 16 applicationContext-rms.xml 17 ->配置项目相关 18 applicationContext-shiro.xml 19 ->配置shiro相关

    (1)pom.xml

     1 <!--1 单元测试-->
     2     junit
     3 <!--2 spring相关依赖 为什么没有spring-beans?-->
     4     <!--核心依赖-->
     5     spring-core
     6     spring-context
     7     spring-context-support
     8     <!--web相关-->
     9     spring-web
    10     spring-webmvc
    11     <!--数据库相关-->
    12     spring-jdbc
    13     spring-tx
    14     <!--redis相关-->
    15     spring-data-redis
    16     jedis
    18 <!--3 mybatis-->
    19     mybatis
    20     mybatis-spring
    21 <!--4 日志-->
    22     slf4j-api
    23     logback-classic
    24 <!--5 JSON-->
    25     fastjson
    26 <!--6 数据库-->
    27     <!--连接池-->
    28     druid
    29     <!--驱动-->
    30     mysql-connector-java
    31     postgresql
    32 <!--7 apache工具-->
    33     commons-beanutils
    34     commons-lang
    35 <!--8 shiro相关依赖-->
    36     shiro-core
    37     shiro-web
    38     shiro-aspectj
    39     shiro-spring
    40     shiro-ehcache
    41     shiro-quartz
    42 <!--9 ehcache相关依赖-->
    43     ehcache
    44 <!--10 servlet-->
    45     javax.servlet-api
    46 <!--11 标签库-->
    47     jstl
    48 <!--12 jersey相关依赖-->
    49    jersey-bundle
    50    jersey-spring
    51       <!-- 这里<exclusions>了spring的几个包,为什么?-->
    52        spring-beans,spring-context,spring-core,spring-web,spring-aop
    53 <!--13 不太明白作用的-->
    54     aspectjweaver
    55     javaee-api                    

    (2)web.xml

     1 <!--配置文件读取-->
     2     contextConfigLocation:classpath*:/spring/**/applicationContext*.xml
     3     logbackConfigLocation:file:/usr/local/***/***/conf/logback.xml
     4 <!--监听器-->
     5     LogbackConfigListener
     6     ContextLoaderListener
     7 <!--Servlet-->
     8     RESTServlet
     9     DruidStatView
    10 <!--过滤器-->
    11     CharacterEncodingFilter
    12     <!--shiroFilter-->
    13     DelegatingFilterProxy

    (3)applicationContext.xml

     1 <!--配置文件读取-->
     2  <context:property-placeholder location=**/>
     3 
     4 <!--支持注解-->
     5 <context:annotation-config/>
     6 
     7 <!--自动扫描的包,过滤被扫描的类-->
     8 <context:component-scan base-package="******">
     9     <context:exclude-filter> ***
    10     <context:include-filter> ***
    11 
    12 <!--dataSource;sqlSeesionFactory;sqlSessionTemplate-->
    13 <bean id="dataSource">
    14 <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
    15     dataSource
    16     typeAliasesPackage
    17     configLocation:classpath:resources/mybatis/sqlMapConfig.xml
    18     mapperLocation: classpath:sql/*.xml
    19 <bean id="sqlSessionTemplate" class="org.mybatis.spring.SqlSessionTemplate"> 20 sqlSessionFactory 21 22 <!--通过自动扫描方式创建mapper bean--> 23 <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> 24 25 <!--事务管理--> 26 <tx:annotation-driven transaction-manager="transactionManager"> 27 <bean id="transactionManager> 28 dataSource 29 30 <!--cache--> 31 <cache:annotation-driven cache-manager="cacheManager" proxy-target-class="false"/> 32 <bean id="ehcacheManager" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"> 33 configLocation:classpath:ehcache/ehcache.xml 34 <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"> 35 cacheManager:ehcacheManager

    (4)application-rms.xml

    1 <!--国际化资源-->
    2 <bean id="messageSource" class="com.baosight.common.message.XinsightResourceBundleMessageSource">

    (5)application-shiro.xml

    //todo

    (6)ehcache.xml

    1 <defaultCache>
    2 <cache name="authorizationCache">
    3 <cache name="authenticationCache">

    (7)sqlMapConfig.xml

    1 <configuration>
    2     <!--除去environments节点(datasource和txmanager本来的位置),其他mybatis的属性都可以在这里设置-->
    3 </configuration>
  • 相关阅读:
    nginx源码分析:module机制
    Linux源码分析之:malloc、free
    shell格式化字符串
    shell执行字符串中的命令
    docker安装并运行mongo
    docker安装并运行kibana
    docker安装并运行elasticsearch
    docker安装并运行rabbitmq
    docker安装并运行ngnix
    docker安装并运行redis
  • 原文地址:https://www.cnblogs.com/lyh421/p/6781304.html
Copyright © 2011-2022 走看看