<?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. 理解 .NET 2015

    去年跟着BUILD之后,我发了一篇文章Exciting Times for .NET 并从那以后我已经很荣幸地能够与.NET团队并肩作战,这其中包括了运行时.框架.语言和编译器.虽然去年我的重心已经更 ...

  2. 使用SpringBoot入门案例

    一.创建项目 二.给根项目UnicomCmp的pom.xml,加入parent节点(spring-boot-starter-parent) <!--Add Spring boot Parent- ...

  3. Linux 系统实时监控的瑞士军刀 —— Glances

    Linux 系统实时监控的瑞士军刀 —— Glances 对于 RHEL/CentOS/Fedora 发行版 ## RHEL/CentOS 7 64-Bit ## # wget http://dl.f ...

  4. Sequel Pro for Mac(MySQL 数据库管理工具)破解版安装

    1.软件简介    Sequel Pro 是一款管理 Mysql 的工具,界面简洁易用. 2.功能特色 FULL MYSQL SUPPORT Sequel Pro is a fast, easy-to ...

  5. 在代码中设置RelativeLayout布局中标签的android:layout_toLeftOf、android:layout_toRightOf等属性

    需要动态改变RelativeLayout里面控件的相对位置,经一个技术群的群友提示,找到了如下的方法,做下记录:   RelativeLayout.Layoutparams params = (Rel ...

  6. 实战c++中的vector系列--vector&lt;unique_ptr&lt;&gt;&gt;初始化(全部权转移)

    C++11为我们提供了智能指针,给我们带来了非常多便利的地方. 那么假设把unique_ptr作为vector容器的元素呢? 形式如出一辙:vector<unique_ptr<int> ...

  7. 菜鸟教程之工具使用(六)——让Maven项目直接在eclipse内部的Tomcat中运行

    Hello,大家好,好久不见!最近终于安定下来了,可以静下心来写东西了.先写篇简单的,找找感觉.工具系列的本身就比较简单,没什么技术含量.因为说到底,工具只是辅助我们工作的,知道怎么用,然后剩下的就是 ...

  8. linux每日命令(4):pwd命令

    Linux中用 pwd 命令来查看"当前工作目录"的完整路径. 简单得说,每当你在终端进行操作时,你都会有一个当前工作目录. 在不太确定当前位置时,就会使用pwd来判定当前目录在文 ...

  9. Oracle的NVL函数用法

    从两个表达式返回一个非 null 值. 语法 NVL(eExpression1, eExpression2) 参数eExpression1, eExpression2 如果 eExpression1 ...

  10. javascript form提交 不执行onsubmit事件解决方案

    转载自:https://www.cnblogs.com/lorgine/archive/2011/03/30/2000284.html 今天做项目过程中,需要用到javascript提交form到后台 ...