一、安装jdk1.7

祥见http://zhinan.sogou.com/guide/detail/?id=1610006590

二、创建web项目

三、配置ssm环境

3.1添加spring、mybatis、springMvc的jar包及他们之间的整合包

3.2添加三个配置文件并配置相关参数

web.xml文件

 <param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<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:applicationContext-mvc.xml</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>springmvc</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>

applicationContext.xml文件

 <!-- 读取properties文件org.springframework.beans.factory.config.PlaceholderConfigurerSupport  -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:dbconfig.properties</value>
</list>
</property>
</bean> <!-- 配置数据库 -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${jdbc.driver}"/>
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}"/>
<property name="password" value="${jdbc.password}"/>
</bean> <!-- 配置会话工厂org.mybatis.spring.SqlSessionFactoryBean -->
<!-- 配置mybatis -->
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
<property name="dataSource" ref="dataSource" />
<property name="configLocation" value="classpath:mybatis-config.xml"></property>
<!-- mapper扫描 -->
<property name="mapperLocations" value="classpath:mybatis/*/*.xml"></property>
</bean> <!-- 启用注解 -->
<context:annotation-config />
<!-- aop激活自动代理功能 -->
<aop:aspectj-autoproxy proxy-target-class="true"/> <!-- 事务处理器 -->
<bean id="txManage" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
<property name="dataSource" ref="dataSource"/>
</bean>

applicationContext-mvc.xml文件

<context:component-scan base-package="com.diancan.controller"/>
<!-- 配置SpringMVC的视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/jsp/"/>
<property name="suffix" value=".jsp"/>
</bean>

mybatis-config.xml文件

<settings>
<setting name="cacheEnabled" value="true" /><!-- 全局映射器启用缓存 -->
<setting name="useGeneratedKeys" value="true" />
<setting name="defaultExecutorType" value="REUSE" />
</settings> <!-- 别名 -->
<typeAliases>
<typeAlias type="com.diancan.util.PageData" alias="pd"/>
<!-- 分页 -->
<typeAlias type="com.diancan.entity.Page" alias="Page"/>
</typeAliases>

dbconfig.properties文件

jdbc.driver:com.mysql.jdbc.Driver
jdbc.url:jdbc:mysql://localhost:3306/diancan
jdbc.username:root
jdbc.password:root

四、创建需要的各种包

let's do it!

spring日记------部署环境、写demo的更多相关文章

  1. Web自动化框架之五一套完整demo的点点滴滴(excel功能案例参数化+业务功能分层设计+mysql数据存储封装+截图+日志+测试报告+对接缺陷管理系统+自动编译部署环境+自动验证false、error案例)

    标题很大,想说的很多,不知道从那开始~~直接步入正题吧 个人也是由于公司的人员的现状和项目的特殊情况,今年年中后开始折腾web自动化这块:整这个原因很简单,就是想能让自己偷点懒.也让减轻一点同事的苦力 ...

  2. Spring Boot入门系列(十五)Spring Boot 开发环境热部署

    在实际的项目开发过中,当我们修改了某个java类文件时,需要手动重新编译.然后重新启动程序的,整个过程比较麻烦,特别是项目启动慢的时候,更是影响开发效率.其实Spring Boot的项目碰到这种情况, ...

  3. ProxySQL Cluster 高可用集群 + MySQL MGR环境部署 (多写模式) 部署记录

    文章转载自:https://blog.51cto.com/u_6215974/4937192 ProxySQL 在早期版本若需要做高可用,需要搭建两个实例,进行冗余.但两个ProxySQL实例之间的数 ...

  4. 从头开始搭建一个Spring boot+RabbitMQ环境

    *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: 0 !important; } /* ...

  5. Spring boot+RabbitMQ环境

    Spring boot+RabbitMQ环境 消息队列在目前分布式系统下具备非常重要的地位,如下的场景是比较适合消息队列的: 跨系统的调用,异步性质的调用最佳. 高并发问题,利用队列串行特点. 订阅模 ...

  6. Spring学习之——手写Spring源码V2.0(实现IOC、D、MVC、AOP)

    前言 在上一篇<Spring学习之——手写Spring源码(V1.0)>中,我实现了一个Mini版本的Spring框架,在这几天,博主又看了不少关于Spring源码解析的视频,受益匪浅,也 ...

  7. spring security oauth2 搭建认证中心demo

    oauth2 介绍 ​ oauth2 协议应该是开发者们耳熟能详的协议了,这里就不做过多的介绍了,具体介绍如何在spring security中搭建oauth2的认证服务.Spring-Securit ...

  8. spring security oauth2搭建resource-server demo及token改造成JWT令牌

    我们在上文讲了如何在spring security的环境中搭建基于oauth2协议的认证中心demo:https://www.cnblogs.com/process-h/p/15688971.html ...

  9. 获取Spring的上下文环境ApplicationContext的方式

    摘自: http://blog.csdn.net/yang123111/article/details/32099329 获取Spring的上下文环境ApplicationContext的方式 Web ...

随机推荐

  1. 特征工程(Feature Enginnering)学习记要

     最近学习特征工程(Feature Enginnering)的相关技术,主要包含两块:特征选取(Feature Selection)和特征抓取(Feature Extraction).这里记录一些要点 ...

  2. [Aaronyang] 写给自己的WPF4.5 笔记24 [与winform交互-flash-DEMO-收尾篇1/6]

      =====潇洒的版权线======www.ayjs.net===== Aaronyang ===== AY ====== 安徽 六安 杨洋 ======   未经允许不许转载 ====== 1.新 ...

  3. Codeforces Beta Round #62 题解【ABCD】

    Codeforces Beta Round #62 A Irrational problem 题意 f(x) = x mod p1 mod p2 mod p3 mod p4 问你[a,b]中有多少个数 ...

  4. mysql简单性能排查

    mysql> show variables; mysql> show processlist; mysql> show status; mysql> show global s ...

  5. python排序算法的实现-冒泡

    1.算法描述: (1)共循环 n-1 次 (2)每次循环中,如果 前面的数大于后面的数,就交换 (3)设置一个标签,如果上次没有交换,就说明这个是已经好了的. 2.代码 #!/usr/bin/pyth ...

  6. Enclosure POJ

    0:Enclosure http://poj.openjudge.cn/challenge3/0/ 查看 提交 统计 提问 总时间限制:  1000ms 内存限制:  131072kB 描述 为了防止 ...

  7. 重建 windows 图标缓存

    执行命令: ie4uinit –show 好像可以吧?

  8. LoadRunner 12 发布,主推云

    LoadRunner 12 发布,主推云 http://blog.csdn.net/testing_is_believing/article/details/22572341

  9. fedora Server 21 安装 Opera 29.0.1795.47

    最新文章:Virson's Blog 安装源: yum localinstall --nogpgcheck http://mirror.yandex.ru/fedora/russianfedora/r ...

  10. Java中利用标签跳出外层循环break

    直接看代码: class ForLoop{ public static void main(String[] args){ //jump from outer loop outer:for(int i ...