<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:p="http://www.springframework.org/schema/p"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- Properties文件读取配置,base的properties -->
<context:property-placeholder location="classpath:jdbc.properties"/> <!-- JNDI获取数据源(使用dbcp连接池) -->
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close" scope="singleton">
<property name="driverClassName" value="${driverClassName}"/>
<property name="url" value="${url}"/>
<property name="username" value="${uname}"/>
<property name="password" value="${password}"/>
<property name="initialSize" value="${initialSize}"/>
<property name="maxActive" value="${maxActive}"/>
<property name="maxIdle" value="${maxIdle}"/>
<property name="minIdle" value="${minIdle}"/>
<property name="maxWait" value="${maxWait}"/>
<property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}"/>
<property name="removeAbandoned" value="${removeAbandoned}"/>
<!-- sql 心跳 -->
<property name= "testWhileIdle" value="true"/>
<property name= "testOnBorrow" value="false"/>
<property name= "testOnReturn" value="false"/>
<property name= "validationQuery" value="select 1"/>
<property name= "timeBetweenEvictionRunsMillis" value="60000"/>
<property name= "numTestsPerEvictionRun" value="${maxActive}"/>
</bean> <!--redis 配置 开始-->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<property name="maxActive" value="90" />
<property name="maxIdle" value="5" />
<property name="maxWait" value="1000" />
<property name="testOnBorrow" value="true" />
</bean>
<bean id="jedisPool" class="redis.clients.jedis.JedisPool" destroy-method="destroy" >
<constructor-arg ref="jedisPoolConfig"/>
<constructor-arg value="10.0.0.194"/>
<constructor-arg value="6379"/>
</bean>
<bean id="redisAPI" class="org.slsale.common.RedisAPI">
<property name="jedisPool" ref="jedisPool"/>
</bean>
<!-- redis 配置结束 --> <!-- mybatis-spring 配置 结束 --> <!-- enable autowire 启用spring mvc 注解-->
<context:annotation-config />
<!-- enable transaction demarcation with annotations -->
<tx:annotation-driven /> <!-- (事务管理)transaction manager, use JtaTransactionManager for global tx -->
<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource" />
</bean>
<!-- define the SqlSessionFactory, notice that configLocation is not needed when you use MapperFactoryBean -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml" />
</bean> <!-- AOP 事务处理 开始 -->
<aop:aspectj-autoproxy />
<aop:config proxy-target-class="true">
<aop:pointcut expression="execution(* *org.slsale.service..*(..))" id="transService"/>
<aop:advisor pointcut-ref="transService" advice-ref="txAdvice" />
</aop:config>
<tx:advice id="txAdvice" transaction-manager="transactionManager">
<tx:attributes>
<tx:method name="hl*" propagation="REQUIRED" rollback-for="Exception" />
</tx:attributes>
</tx:advice>
<!-- AOP 事务处理 结束 --> <!-- scan for mappers and let them be autowired -->
<!-- Mapper接口所在包名,Spring会自动查找其下的Mapper -->
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
<property name="basePackage" value="org.slsale.dao" />
</bean>
</beans>
 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration
PUBLIC "-//mybatis.org//DTD Config 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-config.dtd">
<configuration>
<settings>
<!-- changes from the defaults -->
<setting name="lazyLoadingEnabled" value="false" />
</settings>
<typeAliases>
<!--这里给实体类取别名,方便在mapper配置文件中使用-->
<!-- add by bdqn_hl 2014-2-21 start -->
<typeAlias alias="user" type="org.slsale.pojo.User"/>
<typeAlias alias="function" type="org.slsale.pojo.Function"/>
<typeAlias alias="authority" type="org.slsale.pojo.Authority"/>
<typeAlias alias="dataDictionary" type="org.slsale.pojo.DataDictionary"/>
<typeAlias alias="role" type="org.slsale.pojo.Role"/>
<typeAlias alias="affiche" type="org.slsale.pojo.Affiche"/>
<typeAlias alias="goodsInfo" type="org.slsale.pojo.GoodsInfo"/>
<typeAlias alias="information" type="org.slsale.pojo.Information"/>
<typeAlias alias="goodsPack" type="org.slsale.pojo.GoodsPack"/>
<typeAlias alias="goodsPackAffiliated" type="org.slsale.pojo.GoodsPackAffiliated"/>
<typeAlias alias="uploadTemp" type="org.slsale.pojo.UploadTemp"/>
<typeAlias alias="leaveMessage" type="org.slsale.pojo.LeaveMessage"/>
<typeAlias alias="reply" type="org.slsale.pojo.Reply"/>
<!-- add by bdqn_hl 2014-2-21 end --> <!-- add by bdqn_shy 2014-4-9 start -->
<typeAlias alias="userAccountLog" type="org.slsale.pojo.UserAccountLog"/>
<!-- add by bdqn_shy 2014-4-9 end -->
</typeAliases>
</configuration>

mybatis-config.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
http://www.springframework.org/schema/mvc
http://www.springframework.org/schema/mvc/spring-mvc.xsd"> <mvc:resources mapping="/statics/**" location="/statics/" />
<mvc:annotation-driven/> <!-- 完成请求和注解POJO的映射 -->
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />
<!-- 装配controller -->
<context:component-scan base-package="org.slsale" >
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<!-- 对转向页面的路径解析。prefix:前缀, suffix:后缀 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/pages/" p:suffix=".jsp" /> <!-- 支持上传文件 -->
<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver"/> <mvc:interceptors>
<mvc:interceptor>
<mvc:mapping path="/backend/**" />
<mvc:mapping path="/informanage/**" />
<mvc:mapping path="/member/**" />
<mvc:mapping path="/message/**" />
<bean class="org.slsale.interceptor.SysInterceptor">
</bean>
</mvc:interceptor>
</mvc:interceptors> </beans>

spring-servlet.xml

 <?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<display-name></display-name> <!--指定spring bean的配置文件所在目录 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext-*.xml</param-value>
</context-param> <!-- 配置spring的字符编码为utf-8 -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>encodingFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping> <!--springMVC的配置 -->
<servlet>
<servlet-name>springmvc</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<init-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springmvc-servlet.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping> <!-- spring配置 -->
<listener>
<listener-class> org.springframework.web.context.ContextLoaderListener</listener-class>
</listener> <!-- log4j配置 -->
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>classpath:log4j.properties</param-value>
</context-param>
<context-param>
<param-name>webAppRootKey</param-name>
<param-value>SL.root</param-value>
</context-param> <!-- spring加载log4j的监听 -->
<listener>
<listener-class> org.springframework.web.util.Log4jConfigListener</listener-class>
</listener> <welcome-file-list>
<welcome-file>/WEB-INF/pages/index.jsp</welcome-file>
</welcome-file-list>
</web-app>

web.xml

ssm文件配置的更多相关文章

  1. SpringMVC 学习 十 SSM环境搭建(三)springMVC文件配置

    SpringMVC文件配置的详细过程,可以查看springMVC环境搭建的注解配置篇<springMVC学习三 注解开发环境搭建> <?xml version="1.0&q ...

  2. Spring、Spring MVC、MyBatis整合文件配置详解

    原文  http://www.cnblogs.com/wxisme/p/4924561.html 主题 MVC模式MyBatisSpring MVC 使用SSM框架做了几个小项目了,感觉还不错是时候总 ...

  3. 转载 Spring、Spring MVC、MyBatis整合文件配置详解

    Spring.Spring MVC.MyBatis整合文件配置详解   使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用法最好还是看官方文档. ...

  4. ssm框架配置过程

    1.pom.xml配置 1.1<build>标签中配置<plugins>和<resources>,即插件和资源文件 1.2 <properties>标签 ...

  5. mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置

    mybatis generator配置,Mybatis自动生成文件配置,Mybatis自动生成实体Bean配置 ============================== 蕃薯耀 2018年3月14 ...

  6. idea中ssm自动配置

    自动生成 只需要创建好maven项目,然后创建一个类Test,复制代码粘贴即可 使用注意: 代码 import java.io.*; public class Test { //包名格式 //列如配置 ...

  7. Spring、Spring MVC、MyBatis整合文件配置详解2

    使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用法最好还是看官方文档. Spring:http://spring.io/docs MyBatis ...

  8. ssm基础配置

    1.导包 <dependencies> <dependency> <groupId>org.springframework</groupId> < ...

  9. Spring、Spring MVC、MyBatis 整合文件配置详解

    使用SSM框架做了几个小项目了,感觉还不错是时候总结一下了.先总结一下SSM整合的文件配置.其实具体的用法最好还是看官方文档. Spring:http://spring.io/docs MyBatis ...

随机推荐

  1. dyld`__abort_with_payload:

    dyld`__abort_with_payload: 0x1030422f0 <+0>:  mov    x16, #0x209 0x1030422f4 <+4>:  svc  ...

  2. Git tag 标签操作

    列表 # 列出已有的标签 $ git tag # 为了能及时看到远程上新增的标签, 在上面的命令之前可以fetch一下 git fetch --all --tags --prune # 列出匹配的部分 ...

  3. 基于Centos搭建 Hadoop 伪分布式环境

    软硬件环境: CentOS 7.2 64 位, OpenJDK- 1.8,Hadoop- 2.7 关于本教程的说明 云实验室云主机自动使用 root 账户登录系统,因此本教程中所有的操作都是以 roo ...

  4. EF+LINQ事物处理

    在使用EF的情况下,怎么进行事务的处理,来减少数据操作时的失误,比如重复插入数据等等这些问题,这都是经常会遇到的一些问题 但是如果是我有多个站点,然后存在同类型的角色去操作同一条数据的同一个字段的话, ...

  5. Mydumper介绍

    Mydumper是一个针对MySQL和Drizzle的高性能多线程备份和恢复工具.开发人员主要来自MySQL,Facebook,SkySQL公司.目前已经在一些线上使用了Mydumper. 一.Myd ...

  6. Spark初识

    一.简介 1.什么是Spark 官网地址:http://spark.apache.org/ Apache Spark™是用于大规模数据处理的统一分析引擎. 从右侧最后一条新闻看,Spark也用于AI人 ...

  7. Spring Boot 2.0 热部署指南

    Spring Boot 2.0 支持热部署,实现方法很简单 Spring Boot 2.0 有几种热重载的选项. 推荐的方法是使用spring-boot-devtools 因为它提供了额外的开发时间功 ...

  8. Egret里用矢量挖圆形的洞

    项目里需要用到,但是不是用在新手引导上,下面的代码可以绘制一个圆的四分之一,用四个即可拼出一个圆. private createShape(): egret.Shape { let magicNum ...

  9. 【GMT43智能液晶模块】例程七:定时器PWM实验——简易电子琴

    实验原理: STM32定时器有PWM功能,GMT43模块上带有一无源蜂鸣器,其 PWM输入控制信号接在STM32定时器输出接口上(PB4/TIM3_CH1),可 以通过定时器的PWM输出频率从而控制蜂 ...

  10. Web - JSONP和同源策略漫谈

    0x00 前言 关于JSONP网上有很多文章了,我也是在拜读了别人的文章的基础上来写写自己的看法,这样可以加深自己印象,巩固一下学习效果.我们需要做的就是站在巨人的肩膀上眺望远方. 0x01 起 在W ...