Spring+SpringMVC+Mybatis项目搭建 + gitHub 源码

  1. Springmvc + spring + mybatis的部署
    1. 配置applicationContext
    2. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xmlns:context="http://www.springframework.org/schema/context"

      xmlns:mybatis-spring="http://mybatis.org/schema/mybatis-spring"

      xmlns:jdbc="http://www.springframework.org/schema/jdbc"

      xsi:schemaLocation="http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-4.3.xsd

      http://mybatis.org/schema/mybatis-springhttp://mybatis.org/schema/mybatis-spring-1.2.xsd

      http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.3.xsd

      http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.3.xsd">

       

       

       

       

       

       

       

    3.  配置springmvc.xml
    4. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

      xmlns:context="http://www.springframework.org/schema/context"

      xmlns:mvc="http://www.springframework.org/schema/mvc"

      xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.3.xsd

      http://www.springframework.org/schema/beanshttp://www.springframework.org/schema/beans/spring-beans-4.3.xsd

      http://www.springframework.org/schema/contexthttp://www.springframework.org/schema/context/spring-context-4.3.xsd">

       

       

       

       

 

  1. 配置web.xml
  2.   Archetype Created Web Application

     

    contextConfigLocation

    classpath:conf/applicationContext.xml

     

    org.springframework.web.context.ContextLoaderListener

     

     

    springDispatcherServlet

    org.springframework.web.servlet.DispatcherServlet

    contextConfigLocation

    classpath:conf/springmvc.xml

    1

     

    springDispatcherServlet

    /

 

  1. 配置文件db.properties(这里如果使用配置文件有问题的话,可以自行百度解决办法)
  2. jdbc.driverClass=com.mysql.jdbc.Driver

    jdbc.jdbcUrl=jdbc:mysql://localhost:3306/sakila?characterEncoding=utf8

    jdbc.user=root

    jdbc.password=123456

  3. 查看完整项目代码 https://github.com/zpf2012/SpringMybatisSpringMVC

你可能感兴趣的:(SSM框架)