1. <dependencies>
  2.  
  3. <dependency>
  4. <groupId>junit</groupId>
  5. <artifactId>junit</artifactId>
  6. <version>3.8.1</version>
  7. </dependency>
  8.  
  9. <!--mybatis-spring适配器 -->
  10. <dependency>
  11. <groupId>org.mybatis</groupId>
  12. <artifactId>mybatis-spring</artifactId>
  13. <version>1.3.0</version>
  14. </dependency>
  15.  
  16. <!--mysql数据库驱动 -->
  17. <dependency>
  18. <groupId>mysql</groupId>
  19. <artifactId>mysql-connector-java</artifactId>
  20. <version>5.1.48</version>
  21. </dependency>
  22.  
  23. <!-- 导入dbcp的jar包,用来在applicationContext.xml中配置数据库 -->
  24. <dependency>
  25. <groupId>commons-dbcp</groupId>
  26. <artifactId>commons-dbcp</artifactId>
  27. <version>1.4</version>
  28. </dependency>
  29.  
  30. <!-- 文件上传 -->
  31. <dependency>
  32. <groupId>commons-fileupload</groupId>
  33. <artifactId>commons-fileupload</artifactId>
  34. <version>1.3.3</version>
  35. </dependency>
  36. <dependency>
  37. <groupId>commons-io</groupId>
  38. <artifactId>commons-io</artifactId>
  39. <version>2.4</version>
  40. </dependency>
  41. <!--log4j日志包 -->
  42. <dependency>
  43. <groupId>log4j</groupId>
  44. <artifactId>log4j</artifactId>
  45. <version>1.2.17</version>
  46. </dependency>
  47.  
  48. <!-- spring配置 -->
  49. <dependency>
  50. <groupId>org.springframework</groupId>
  51. <artifactId>spring-context</artifactId>
  52. <version>4.3.5.RELEASE</version>
  53. </dependency>
  54. <dependency>
  55. <groupId>org.springframework</groupId>
  56. <artifactId>spring-orm</artifactId>
  57. <version>4.3.5.RELEASE</version>
  58. </dependency>
  59. <dependency>
  60. <groupId>org.springframework</groupId>
  61. <artifactId>spring-web</artifactId>
  62. <version>4.3.5.RELEASE</version>
  63. </dependency>
  64.  
  65. <dependency>
  66. <groupId>org.springframework</groupId>
  67. <artifactId>spring-webmvc</artifactId>
  68. <version>4.3.5.RELEASE</version>
  69. </dependency>
  70. <dependency>
  71. <groupId>org.springframework</groupId>
  72. <artifactId>spring-test</artifactId>
  73. <version>4.3.5.RELEASE</version>
  74. </dependency>
  75. <dependency>
  76. <groupId>org.springframework</groupId>
  77. <artifactId>spring-tx</artifactId>
  78. <version>4.3.5.RELEASE</version>
  79. </dependency>
  80. <!-- mybatis -->
  81. <dependency>
  82. <groupId>org.mybatis</groupId>
  83. <artifactId>mybatis</artifactId>
  84. <version>3.2.6</version>
  85. </dependency>
  86.  
  87. <!-- 标签库 -->
  88.  
  89. <!-- JSTL -->
  90. <dependency>
  91. <groupId>javax.servlet</groupId>
  92. <artifactId>jstl</artifactId>
  93. <version>1.2</version>
  94. </dependency>
  95. <!-- JSTL实现包 -->
  96. <dependency>
  97. <groupId>org.apache.taglibs</groupId>
  98. <artifactId>taglibs-standard-impl</artifactId>
  99. <version>1.2.5</version>
  100. </dependency>
  101.  
  102. <dependency>
  103. <groupId>com.fasterxml.jackson.core</groupId>
  104. <artifactId>jackson-databind</artifactId>
  105. <version>2.9.10.1</version>
  106. </dependency>
  107.  
  108. <!-- 补充aop非核心依赖 -->
  109. <dependency>
  110. <groupId>org.aspectj</groupId>
  111. <artifactId>aspectjrt</artifactId>
  112. <version>1.6.11</version>
  113. </dependency>
  114.  
  115. <dependency>
  116. <groupId>org.aspectj</groupId>
  117. <artifactId>aspectjweaver</artifactId>
  118. <version>1.6.11</version>
  119. </dependency>
  120.  
  121. <!-- 解决jsp报错 -->
  122. <dependency>
  123. <groupId>javax.servlet</groupId>
  124. <artifactId>javax.servlet-api</artifactId>
  125. <version>3.0.1</version>
  126. <scope>provided</scope>
  127. </dependency>
  128.  
  129. <dependency>
  130. <groupId>javax.servlet.jsp</groupId>
  131. <artifactId>jsp-api</artifactId>
  132. <version>2.1</version>
  133. <scope>provided</scope>
  134. </dependency>
  135. </dependencies>
  136. <!-- 指明编译源代码时使用的字符编码,maven编译的时候默认使用的GBK编码, 通过project.build.sourceEncoding属性设置字符编码,告诉maven这个项目使用UTF-8来编译 -->
  137. <properties>
  138. <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  139. </properties>

 配置web.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
    id="WebApp_ID" version="2.5">
  3. <display-name>ssm_Demo</display-name>
  4.  
  5. <welcome-file-list>
  6.  
  7. <welcome-file>index.html</welcome-file>
  8. </welcome-file-list>
  9.  
  10. <!-- 编码过滤器开始 -->
  11. <filter>
  12. <filter-name>EncodeingFilter</filter-name>
  13. <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
  14. <init-param>
  15. <param-name>encoding</param-name>
  16. <param-value>UTF-8</param-value>
  17. </init-param>
  18. </filter>
  19. <filter-mapping>
  20. <filter-name>EncodeingFilter</filter-name>
  21. <servlet-name>springmvc</servlet-name>
  22. </filter-mapping>
  23. <!-- 编码过滤器结束 -->
  24. <!-- log4j配置文件地址 -->
  25. <context-param>
  26. <param-name>log4jConfigLocation</param-name>
  27. <param-value>classpath*:log4j.properties</param-value>
  28. </context-param>
  29. <!-- Log4j的监听器要放在spring监听器前面 -->
  30. <!--Log4jConfigListener是不需要配的,因为有ContextLoaderListener -->
  31.  
  32. <!-- 监听器开始 -->
  33. <listener>
  34. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  35. </listener>
  36. <context-param>
  37. <param-name>contextConfigLocation</param-name>
  38. <param-value>classpath*:applicationContext.xml</param-value>
  39. </context-param>
  40. <!-- 监听器结束 -->
  41.  
  42. <!-- 前端控制器开始 -->
  43. <servlet>
  44. <servlet-name>springmvc</servlet-name>
  45. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  46. <init-param>
  47. <param-name>contextConfigLocation</param-name>
  48. <param-value>classpath*:springmvc.xml</param-value>
  49. </init-param>
  50. <load-on-startup>1</load-on-startup>
  51. </servlet>
  52. <servlet-mapping>
  53. <servlet-name>springmvc</servlet-name>
  54. <url-pattern>*.do</url-pattern>
  55. </servlet-mapping>
  56. <!-- 前端控制器结束 -->
  57. <!-- 自己配置描述文件,需要多少个描述文件就配置多少 -->
  58.  
  59. </web-app>

mvc.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:mvc="http://www.springframework.org/schema/mvc"
  6. xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
  7. http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
  9.  
  10. <!-- 扫描controller 扫描完整的路径名!!不是必须 -->
  11. <context:component-scan base-package="cn.jeep.UserController"></context:component-scan>
  12. <context:component-scan base-package="cn.jeep.CarController"></context:component-scan>
      
  13. <!-- 配置映射器和适配器 -->
  14. <mvc:annotation-driven></mvc:annotation-driven>
  15. <!-- 配置前视图解析器 -->
  16. <bean
  17. class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  18. <!-- 注入前后缀 -->
  19. <property name="prefix" value="/"></property>
  20. <property name="suffix" value=".jsp"></property>
  21. </bean>
  22.  
  23. <!-- 配置静态文件放行 -->
  24. <mvc:default-servlet-handler></mvc:default-servlet-handler>
  25. <mvc:resources location="/js/" mapping="//js/**" />
  26. <mvc:resources location="/css/" mapping="/css/**" />
  27. <mvc:resources location="/image/" mapping="/image/**" />
  28.  
  29. <!--登录拦截器 配置了拦截器和拦截路径 -->
  30. <mvc:interceptors>
  31. <mvc:interceptor>
  32. <mvc:mapping path="/user/lookdingdan.do"/>
  33. <bean class="cn.jeep.Interceptor.loginInterceptor"/>
  34. </mvc:interceptor>
  35. </mvc:interceptors>
  36. </beans>

servise.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xmlns:tx="http://www.springframework.org/schema/tx"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  8. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  9. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
  10. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
  11.  
  12. <context:component-scan base-package="cn.jeep.UserServiseImpl"></context:component-scan>
  13. <context:component-scan base-package="cn.jeep.CarServiseImpl"></context:component-scan>
  14. <!-- 1,声明事务管理器 -->
  15. <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
  16. <property name="dataSource" ref="dataSource"></property>
  17. </bean>
  18. <!-- 启动注解事务 -->
  19. <!-- <tx:annotation-driven/> -->
  20. <!-- 2,声明事务的传播特性 也就是通知 -->
  21. <tx:advice id="advise" transaction-manager="transactionManager">
  22. <tx:attributes>
  23. <!-- 以add开头的方法名需要事务 -->
  24. <tx:method name="add*" propagation="REQUIRED"/>
  25. <tx:method name="save*" propagation="REQUIRED"/>
  26. <tx:method name="update*" propagation="REQUIRED"/>
  27. <tx:method name="delete*" propagation="REQUIRED"/>
  28. <tx:method name="change*" propagation="REQUIRED"/>
  29. <tx:method name="reset*" propagation="REQUIRED"/>
  30. <tx:method name="get*" read-only="true"/>
  31. <tx:method name="load*" read-only="true"/>
  32. <tx:method name="*" read-only="true"/>
  33. </tx:attributes>
  34. </tx:advice>
  35. <!-- 3进行AOP织入 -->
  36. <aop:config>
  37. <!-- 声明切面 -->
  38. <aop:pointcut expression="execution(* cn.jeep.UserServiseImpl.*.*(..))" id="pc1"/>
  39. <aop:pointcut expression="execution(* cn.jeep.CarServiseImpl.*.*(..))" id="pc2"/>
  40. <!-- 织入 -->
  41. <aop:advisor advice-ref="advise" pointcut-ref="pc1"/>
  42. <aop:advisor advice-ref="advise" pointcut-ref="pc2"/>
  43. </aop:config>
  44.  
  45. </beans>

mybatis配置

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  8. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
  9.  
  10. <!-- 外部引入数据库配置 -->
  11. <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
  12. <property name="location" value="classpath:db.properties"></property>
  13. </bean>
  14.  
  15. <!-- 使用dbcp的数据源 -->
  16. <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" >
  17. <!-- 注入连接属性 -->
  18. <property name="driverClassName" value="${driverClassName}"></property>
  19. <property name="url" value="${url}"></property>
  20. <property name="username" value="${username}"></property>
  21. <property name="password" value="${password}"></property>
  22. <!-- 设置初始化连接池大小 -->
  23. <property name="initialSize" value="5"></property>
  24. <!-- 设置最大连接数 -->
  25. <property name="maxIdle" value="50"></property>
  26. <!-- 设置最大活动连接数 -->
  27. <property name="maxActive" value="10"></property>
  28. <!-- 设置等待时间 -->
  29. <property name="maxWait" value="5000"></property>
  30.  
  31. </bean>
  32.  
  33. <!-- 声明sessionFactory -->
  34. <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
  35. <!-- 注入数据源 -->
  36. <property name="dataSource" ref="dataSource"></property>
  37. <!-- 注入mapper.xml -->
  38. <property name="mapperLocations">
  39. <array>
  40. <value>classpath:Mapper/*/*Mapper.xml</value>
  41. </array>
  42. </property>
  43. </bean>
  44.  
  45. <!-- 扫描mapper接口 -->
  46. <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
  47. <!-- 注入mapper接口所在的包 注意多个包的情况的配置 -->
  48. <property name="basePackage" >
  49. <value>
  50. cn.jeep.UserMapper
  51. cn.jeep.CarMapper
  52. </value>
  53. </property>
  54. <!-- 注入sqlSessionFactory -->
  55. <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory"></property>
  56. </bean>
  57.  
  58. </beans>

app_content.xml

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns="http://www.springframework.org/schema/beans"
  3. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4. xmlns:context="http://www.springframework.org/schema/context"
  5. xmlns:aop="http://www.springframework.org/schema/aop"
  6. xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  7. http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  8. http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
  9.  
  10. <import resource="classpath:appliction-Servise.xml"/>
  11. <import resource="classpath:MyBatis-Config.xml"/>
  12. </beans>

SSM基础pom和xml的整合配置的更多相关文章

  1. ssm框架中applicationContext.xml文件中配置别名

    在applicationContext.xml中配置如下: 通过以下property标签中给定name属性value属性及对应的值,来将domain包下所有实体类设置别名. 在xxxDao.xml中 ...

  2. SSM Spring +SpringMVC+Mybatis 整合配置 及pom.xml

    SSM Spring +SpringMVC+Mybatis 配置 及pom.xml SSM框架(spring+springMVC+Mybatis) pom.xml文件 maven下的ssm整合配置步骤

  3. SSM整合配置(Spring+Spring MVC+Mybatis)

    一.配置准备   通过Maven工程,在eclipse中整合SSM,并在Tomcat服务器上运行 在进行配置前,先理清楚要配置哪些文件,如图,除web.xml外,其余三个配置文件名称均可自定义: 如图 ...

  4. ssm框架整合配置,用maven配置依赖jar包

    1.创建maven project 首先在pom.xml中指定工程所依赖的jar包 <project xmlns="http://maven.apache.org/POM/4.0.0& ...

  5. SSM 整合配置

    目录 1. Maven : pox.xml 2. Web container : web.xml 3. Spring context : dbconfig.properties + applicati ...

  6. Maven中pom.xml文件的配置

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/20 ...

  7. 配置ssm 时, web.xml 文件无 # 自动代码提示

    环境:STS 版本:spring-tool-suite-3.8.1.RELEASE-e4.6-win32-x86_64 配置ssm 时, web.xml 文件无 如下图蓝色圈范围内的提示 问题与 链接 ...

  8. Spring Boot系列(一) Spring Boot介绍和基础POM文件

    Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置.通过 ...

  9. ssm基础搭建步骤

    今天搭建新的项目环境,从网上找了些ssm的搭建步骤,终于找到了一位csdn的大佬,可以说写的特别详细,按照上面步骤搭建即可,为了方便日后参考,转载到本人博客,原文链接:https://blog.csd ...

随机推荐

  1. 日日算法:Dijkstra算法

    介绍 Dijistra算法作为一种最短路径算法,可以用来计算一个节点到图上其他节点的最短距离. 主要是通过启发式的思想,由中心节点层层向外拓展,直到找到中点. 适用于无向图和有向图. 算法思想 假设我 ...

  2. 再砸4.35亿美元,LG疯狂扩建太阳能电池生产线

    LG在收缩高分辨率电视和其他消费电子产品业务的同时,在太阳能面板业务上却很明显一直在进行扩张.LG公司表示,他们将斥资4.35亿美元在韩国工厂增加超过6条生产线,使其太阳能电池生产量能够在2018年达 ...

  3. MySQL权限原理及删除MySQL的匿名账户

    MySQL权限系统的工作原理 MySQL权限系统通过下面两个阶段进行认证: (1)对连接的用户进行身份认证,合法的用户通过认证,不合法的用户拒绝连接: (2)对通过认证的合法用户赋予相应的权限,用户可 ...

  4. 设置 Linux 支持中文

    1.首先在 command 输入 locale,可以看到 Linux 下默认的系统语言的是英文 2.vim ~/.bashrc 打开这个文件,该文件夹相当于系统配置文件 3.打开后,将后三行命令输入到 ...

  5. IIS搭建网站(二)

    win+IIS+ASP+ACCESS第二种搭建方式 安装 控制面板”,依次选“添加/删除程序”, 添加/删除Windows组件 在应用程序服务器前打钩.点击详细信息 将“Internet信息服务(II ...

  6. 《Docker从入门到跑路》之Dockerfile基本操作

    一.简介 Dockerfile是一个文本文件,里面包含一条条指令,每一条指令就是一层镜像.一般情况下,Dockerfile分为4个部分: 基础镜像 维护者信息 镜像操作指令 容器启动时执行命令 例如: ...

  7. python恺撒密码 与 字符串反码 【chr()与ord()函数的两种不同应用】

    恺撒密码  描述 恺撒密码是古罗马凯撒大帝用来对军事情报进行加解密的算法,它采用了替换方法对信息中的每一个英文字符循环替换为字母表序列中该字符后面的第三个字符,即,字母表的对应关系如下:‪‬‪‬‪‬‪ ...

  8. Java——Java自动装箱和拆箱

    一.什么是自动装箱和拆箱: 我们知道java为8种基本类型分别提供了对应的包装类型,在Java SE5之前,如果要生成一个数值为10的Integer对象,必须这样进行: Integer i=new I ...

  9. 用纯css、JavaScript、jQuery简单的轮播图

    完成一个可以自动切换或点击数字的轮播图 HTML代码只需要一个div 包含着一个图片和一个列表,我们主要的思路就是通过点击相应的数字,改变图片的 路径. 有4张图片都在img文件夹里,名称为  img ...

  10. GIL-Guilds(黑白灰染色)

    传送门门门门门咩咩咩咩咩咩咩咩咩咩咩咩 \(这题真是扯谈!!!\) \(灰色很高级是吧,但是题目没要你把颜色全部用上去啊!!!\) \(黑色或者白色只有一个条件,但灰色需要和所有三种颜色都相邻.这么难 ...