springmvc整合redis架构搭建实例

新换环境,又有新东西可以学习了,哈皮! 抽空学习之余看了一下redis,个人对Springmvc的爱是忠贞不渝,所以整理了一下Springmvc整合redis的环境搭建。分享学习。

  第一步: 创建maven项目:

  实例pom.xml内容如下

  <?xml version="1.0" encoding="UTF-8"?>

  <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <packaging>war</packaging>

  <name>orm-bae</name>

  <groupId>com.orm</groupId>

  <artifactId>orm-bae</artifactId>

  <version>0.0.1-SNAPSHOT</version>

  <properties>

  <org.springframework.version>3.0.5.RELEASE</org.springframework.version>

  <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

  </properties>

  <dependencies>

  <!-- config junit jar -->

  <dependency>

  <groupId>junit</groupId>

  <artifactId>junit</artifactId>

  <version>4.8.2</version>

  <scope>test</scope>

  </dependency>

  <!-- config redis data and client jar-->

  <dependency>

  <groupId>org.springframework.data</groupId>

  <artifactId>spring-data-redis</artifactId>

  <version>1.0.2.RELEASE</version>

  </dependency>

  <dependency>

  <groupId>redis.clients</groupId>

  <artifactId>jedis</artifactId>

  <version>2.1.0</version>

  </dependency>

  <!-- config need jar -->

  <dependency>

  <groupId>commons-lang</groupId>

  <artifactId>commons-lang</artifactId>

  <version>2.6</version>

  </dependency>

  <dependency>

  <groupId>org.apache.geronimo.specs</groupId>

  <artifactId>geronimo-servlet_3.0_spec</artifactId>

  <version>1.0</version>

  </dependency>

  <!-- cofig spring jar -->

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-core</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-expression</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-beans</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-aop</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-context</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-context-support</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-tx</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-jdbc</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-orm</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-oxm</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-web</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-webmvc</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-webmvc-portlet</artifactId>

  <version>${org.springframework.version}</version>

  </dependency>

  <dependency>

  <groupId>org.springframework</groupId>

  <artifactId>spring-test</artifactId>

  <version>${org.springframework.version}</version>

  <scope>test</scope>

  </dependency>

  </dependencies>

  <build>

  <resources>

  <resource>

  <directory>/src/main/resources</directory>

  <filtering>true</filtering>

  </resource>

  </resources>

  </build>

  </project>

  第二步:配置文件整合

  Web.xml文件配置

  <?xml version="1.0" encoding="UTF-8"?>

  <web-app version="2.4"

  xmlns="http://java.sun.com/xml/ns/j2ee"

  xmlns:xsi="w3.org/2001/XMLSchema-instance"

  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">

  <listener>

  <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>

  </listener>

  <context-param>

  <param-name>contextConfigLocation</param-name>

  <param-value>/WEB-INF/context/spring-context.xml</param-value>

  </context-param>

  <!-- Spring字符集过滤器 -->

  <filter>

  <filter-name>SpringEncodingFilter</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>SpringEncodingFilter</filter-name>

  <url-pattern>/*</url-pattern>

  </filter-mapping>

  <servlet>

  <servlet-name>mvc</servlet-name>

  <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

  <init-param>

  <param-name>contextConfigLocation</param-name>

  <param-value>/WEB-INF/context/spring-mvc.xml</param-value>

  </init-param>

  <load-on-startup>2</load-on-startup>

  </servlet>

  <servlet-mapping>

  <servlet-name>mvc</servlet-name>

  <url-pattern>/</url-pattern>

  </servlet-mapping>

  <welcome-file-list>

  <welcome-file>index.jsp</welcome-file>

  </welcome-file-list>

  </web-app>

  spring-context.xml内容

  <?xml version="1.0" encoding="UTF-8"?>

  <beans xmlns="springframework.org/schema/beans"

  xmlns:xsi="w3.org/2001/XMLSchema-instance" xmlns:p="springframework.org/schema/p"

  xmlns:mvc="springframework.org/schema/mvc" xmlns:context="springframework.org/schema/context"

  xmlns:util="springframework.org/schema/util"

  xsi:schemaLocation="springframework.org/schema/beans springframework.org/schema/beans/spring-beans-3.0.xsd

  springframework.org/schema/context springframework.org/schema/context/spring-context-3.0.xsd

  springframework.org/schema/mvc springframework.org/schema/mvc/spring-mvc-3.0.xsd

  springframework.org/schema/util springframework.org/schema/util/spring-util-3.0.xsd">

  <!-- 激活@Controller模式 -->

  <mvc:annotation-driven />

  <!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 需要更改 -->

  <context:component-scan base-package="com.pudp.bae.*" />

  <!-- 引入同文件夹下的redis属性配置文件 -->

  <import resource="redis-context.xml"/>

  </beans>

  redis-context.xml内容

  <beans     xmlns="springframework.org/schema/beans"

  xmlns:xsi="w3.org/2001/XMLSchema-instance"

  xmlns:p="springframework.org/schema/p"

  xmlns:tx="springframework.org/schema/tx"

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

  xsi:schemaLocation="

  springframework.org/schema/beans

  springframework.org/schema/beans/spring-beans-3.0.xsd

  springframework.org/schema/tx

  springframework.org/schema/tx/spring-tx-3.0.xsd

  springframework.org/schema/context

  springframework.org/schema/context/spring-context-3.0.xsd

  ">

  <!-- scanner redis properties  -->

  <context:property-placeholder location="/WEB-INF/property/redis.properties" />

  <bean id="poolConfig" class="redis.clients.jedis.JedisPoolConfig">

  <property name="maxIdle" value="${redis.maxIdle}" />

  <property name="maxActive" value="${redis.maxActive}" />

  <property name="maxWait" value="${redis.maxWait}" />

  <property name="testOnBorrow" value="${redis.testOnBorrow}" />

  </bean>

<bean id="connectionFactory" class="org.springframework.data.redis.connection.jedis.JedisConnectionFactory"

  p:host-name="${redis.host}"

  p:port="${redis.port}"

  p:password="${redis.pass}"

  p:pool-config-ref="poolConfig"/>

  <bean id="redisTemplate" class="org.springframework.data.redis.core.StringRedisTemplate">

  <property name="connectionFactory"   ref="connectionFactory" />

  </bean>

  </beans>

  Redis.properties文件内容

  # Redis settings

  #redis.host=192.168.20.101

  #redis.port=6380

  #redis.pass=foobared

  redis.host=127.0.0.1

  redis.port=6379

  redis.pass=

  redis.maxIdle=300

  redis.maxActive=600

  redis.maxWait=1000

  redis.testOnBorrow=true

  第三步:Springmvc对Redis的支持与实例应用。

  实例对象

  package com.pudp.bae.model;

  import com.pudp.bae.base.BaseModel;

  public class Member extends BaseModel{

  /**

  *

  */

  private static final long serialVersionUID = -1959528436584592183L;

  private String id;

  private String nickname;

  public Member(){}

  public Member(String id, String nickname){

  this.setId(id);

  this.setNickname(nickname);

  }

  public String getId() {

  return id;

  }

  public void setId(String id) {

  this.id = id;

  }

  public String getNickname() {

  return nickname;

  }

  public void setNickname(String nickname) {

  this.nickname = nickname;

  }

  }

  

  Redis对象持久化操作

  package com.pudp.bae.base;

  import java.io.Serializable;

  import org.springframework.beans.factory.annotation.Autowired;

  import org.springframework.data.redis.core.RedisTemplate;

  import org.springframework.data.redis.serializer.RedisSerializer;

  public abstract class RedisGeneratorDao<K extends Serializable, V extends Serializable>  {

  @Autowired

  protected RedisTemplate<K,V> redisTemplate ;

  /**

  * 设置redisTemplate

  * @param redisTemplate the redisTemplate to set

  */

  public void setRedisTemplate(RedisTemplate<K, V> redisTemplate) {

  this.redisTemplate = redisTemplate;

  }

  /**

  * 获取 RedisSerializer

  * <br>------------------------------<br>

  */

  protected RedisSerializer<String> getRedisSerializer() {

  return redisTemplate.getStringSerializer();

  }

  }

  package com.pudp.bae.base;

  import java.io.Serializable;

  import org.springframework.beans.factory.annotation.Autowired;

  import org.springframework.data.redis.core.RedisTemplate;

  import org.springframework.data.redis.serializer.RedisSerializer;

  public abstract class RedisGeneratorDao<K extends Serializable, V extends Serializable>  {

  @Autowired

  protected RedisTemplate<K,V> redisTemplate ;

  /**

  * 设置redisTemplate

  * @param redisTemplate the redisTemplate to set

  */

  public void setRedisTemplate(RedisTemplate<K, V> redisTemplate) {

  this.redisTemplate = redisTemplate;

  }

  /**

  * 获取 RedisSerializer

  * <br>------------------------------<br>

  */

  protected RedisSerializer<String> getRedisSerializer() {

  return redisTemplate.getStringSerializer();

  }

  }

  redis对象操作

  package com.pudp.bae.dao.redis;

  import java.util.ArrayList;

  import java.util.List;

  import org.springframework.dao.DataAccessException;

  import org.springframework.data.redis.connection.RedisConnection;

  import org.springframework.data.redis.core.RedisCallback;

  import org.springframework.data.redis.serializer.RedisSerializer;

  import org.springframework.stereotype.Repository;

  import org.springframework.util.Assert;

  import com.pudp.bae.base.RedisGeneratorDao;

  import com.pudp.bae.model.Member;

  /**

  * 参看博客 <br>

  * -------------------------------------------------------------------------------

  *  http://blog.csdn.net/java2000_wl/article/details/8543203

  * -------------------------------------------------------------------------------

  */

  @Repository(value="memberDao")

  public class MemberDaoImpl extends RedisGeneratorDao<String,Member> implements MemberDao{

  /**

  * 添加对象

  */

  @Override

  public boolean add(final Member member) {

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  return connection.setNX(key, name);

  }

  });

  return result;

  }

  /**

  * 添加集合

  */

  @Override

  public boolean add(final List<Member> list) {

  Assert.notEmpty(list);

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  for (Member member : list) {

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  connection.setNX(key, name);

  }

  return true;

  }

  }, false, true);

  return result;

  }

  /**

  * 删除对象 ,依赖key

  */

  public void delete(String key) {

  List<String> list = new ArrayList<String>();

  list.add(key);

  delete(list);

  }

  /**

  * 删除集合 ,依赖key集合

  */

  public void delete(List<String> keys) {

  redisTemplate.delete(keys);

  }

  /**

  * 修改对象

  */

  public boolean update(final Member member) {

  String key = member.getId();

  if (get(key) == null) {

  throw new NullPointerException("数据行不存在, key = " + key);

  }

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  connection.set(key, name);

  return true;

  }

  });

  return result;

  }

  /**

  * 根据key获取对象

  */

  public Member get(final String keyId) {

  Member result = redisTemplate.execute(new RedisCallback<Member>() {

  public Member doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key = serializer.serialize(keyId);

  byte[] value = connection.get(key);

  if (value == null) {

  return null;

  }

  String nickname = serializer.deserialize(value);

  return new Member(keyId, nickname);

  }

  });

  return result;

  }

  }

  package com.pudp.bae.dao.redis;

  import java.util.ArrayList;

  import java.util.List;

  import org.springframework.dao.DataAccessException;

  import org.springframework.data.redis.connection.RedisConnection;

  import org.springframework.data.redis.core.RedisCallback;

  import org.springframework.data.redis.serializer.RedisSerializer;

  import org.springframework.stereotype.Repository;

  import org.springframework.util.Assert;

  import com.pudp.bae.base.RedisGeneratorDao;

  import com.pudp.bae.model.Member;

  /**

  * 参看博客 <br>

  * -------------------------------------------------------------------------------

  *  http://blog.csdn.net/java2000_wl/article/details/8543203

  * -------------------------------------------------------------------------------

  */

  @Repository(value="memberDao")

  public class MemberDaoImpl extends RedisGeneratorDao<String,Member> implements MemberDao{

  /**

  * 添加对象

  */

  @Override

  public boolean add(final Member member) {

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  return connection.setNX(key, name);

  }

  });

  return result;

  }

  /**

  * 添加集合

  */

  @Override

  public boolean add(final List<Member> list) {

  Assert.notEmpty(list);

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  for (Member member : list) {

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  connection.setNX(key, name);

  }

  return true;

  }

}, false, true);

  return result;

  }

  /**

  * 删除对象 ,依赖key

  */

  public void delete(String key) {

  List<String> list = new ArrayList<String>();

  list.add(key);

  delete(list);

  }

  /**

  * 删除集合 ,依赖key集合

  */

  public void delete(List<String> keys) {

  redisTemplate.delete(keys);

  }

  /**

  * 修改对象

  */

  public boolean update(final Member member) {

  String key = member.getId();

  if (get(key) == null) {

  throw new NullPointerException("数据行不存在, key = " + key);

  }

  boolean result = redisTemplate.execute(new RedisCallback<Boolean>() {

  public Boolean doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key  = serializer.serialize(member.getId());

  byte[] name = serializer.serialize(member.getNickname());

  connection.set(key, name);

  return true;

  }

  });

  return result;

  }

  /**

  * 根据key获取对象

  */

  public Member get(final String keyId) {

  Member result = redisTemplate.execute(new RedisCallback<Member>() {

  public Member doInRedis(RedisConnection connection)

  throws DataAccessException {

  RedisSerializer<String> serializer = getRedisSerializer();

  byte[] key = serializer.serialize(keyId);

  byte[] value = connection.get(key);

  if (value == null) {

  return null;

  }

  String nickname = serializer.deserialize(value);

  return new Member(keyId, nickname);

  }

  });

  return result;

  }

  }

  Controller实现

  package com.pudp.bae.controller;

  import java.util.HashMap;

  import java.util.Map;

  import javax.annotation.Resource;

  import javax.servlet.http.HttpServletRequest;

  import javax.servlet.http.HttpServletResponse;

  import org.springframework.stereotype.Controller;

  import org.springframework.web.bind.annotation.ModelAttribute;

  import org.springframework.web.bind.annotation.PathVariable;

  import org.springframework.web.bind.annotation.RequestMapping;

  import org.springframework.web.bind.annotation.RequestMethod;

  import org.springframework.web.servlet.ModelAndView;

  import com.pudp.bae.base.BaseMultiController;

  import com.pudp.bae.model.Member;

  import com.pudp.bae.service.MemberService;

  @Controller

  @RequestMapping(value="/member")

  public class MemberController extends BaseMultiController{

  @Resource(name="memberService")

  private MemberService memberService;

  public void setMemberService(MemberService memberService) {

  this.memberService = memberService;

  }

  @RequestMapping(value={"/add","/add.html"},method={RequestMethod.GET})

  public ModelAndView add(HttpServletRequest request,HttpServletResponse response){

  Map<String,Object> map = new HashMap<String, Object>();

  return toView("member/add", map);

  }

  @RequestMapping(value={"/add","/add.html"},method={RequestMethod.POST})

  public ModelAndView addMember(HttpServletRequest request,HttpServletResponse response,

  @ModelAttribute("member")Member member){

  Map<String,Object> map = new HashMap<String, Object>();

  System.out.println(member);

  map.put("message", "成功添加数据到库," + member);

  this.memberService.add(member);

  return toView("member/message", map);

  }

  @RequestMapping(value={"/{id:\\d+}/query","/{id:\\d+}/query.html"},method={RequestMethod.GET,RequestMethod.POST})

  public ModelAndView queryMember(HttpServletRequest request,HttpServletResponse response,

  @PathVariable("id")String id){

  Map<String,Object> map = new HashMap<String, Object>();

  System.out.println(id);

  Member member = this.memberService.get(id);

  if(null!=member){

  map.put("message", "查询Id=" + id + "的用户名为:" + member.getNickname());

  }else{

  map.put("message", "没有查询到与Id=" + id + "相关的数据");

  }

  return toView("member/message", map);

  }

  @RequestMapping(value={"/{id:\\d+}/delete","/{id:\\d+}/delete.html"},method={RequestMethod.GET,RequestMethod.POST})

  public ModelAndView deleteMember(HttpServletRequest request, HttpServletResponse response,

  @PathVariable("id")String id){

  Map<String,Object> map = new HashMap<String, Object>();

  try {

  this.memberService.delete(id);

  map.put("message", "删除Id为" + id +"的用户成功。");

  } catch (Exception e) {

  e.printStackTrace();

  map.put("message", "删除Id为" + id +"的用户失败, "+e.getMessage());

  }

  return toView("member/message", map);

  }

  }

  整合完毕。

时间: 2024-10-23 15:52:23

springmvc整合redis架构搭建实例的相关文章

Springmvc整合redis

1.软件环境Springmvc4.1.1.RELEASE+redis服务端(2.8.19) 2.添加基于maven支持的redis.clients(最新的2.6.2) <!--redis--> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.6.2</version> </dep

企业级LNMP架构搭建实例(基于Centos6.x)

1.1 部署LNMP架构说明 1.1.1 LNMP架构内容 01.部署linux系统 02.部署nginx网站服务 03.部署mysql数据库服务 04.部署php动态解析服务 1.1.2 配置LNMP架构步骤 01.配置Nginx配置文件 02.配置mysql数据库信息(SQL语句) 03.配置wordpress博客网站 1.1.3 架构服务器串联 01.数据库数据信息迁移(web服务器上的mysql数据 迁移到10.0.0.51 数据库服务器上) 02.将本地储存数据挂载到NFS共享储存服务

Spring3+Hibernate4+SpringMVC整合Ext:项目架构搭建

前言 前段时间突然想用SpringMVC结合Ext做一个框架原型,整合后发现SpringMVC配合Ext简直天衣无缝,当然SpringMVC结合别的UI框架应该也是天衣无缝的.SpringMVC比Struts2确实要强大很多,特别对于Ext框架JSON数据的完美支撑,开发起来相当舒服.Spring3整合Hibernate4的时候可能有点问题,跟Spring2+Hibernate3有很大的区别,区别在于Hibernate4实现了对事务的管理,所以Spring针对Hibernate4就没有提供Hib

SpringMVC笔记——SSM框架搭建简单实例

落叶枫桥 博客园 首页 新随笔 联系 订阅 管理 SpringMVC笔记——SSM框架搭建简单实例 简介 Spring+SpringMVC+MyBatis框架(SSM)是比较热门的中小型企业级项目开发的框架,对于新手来说也是比较容易学习入门的.虽说容易,但在框架搭建过程中仍然遇到了许多问题,因此用实例记录下来吧. 实例 第一步——导包 Spring框架包及其依赖包 MyBatis框架包及其依赖包 MyBatis-EhCache架包 C3P0架包 MySql数据库驱动包 项目架包如下: 项目结构如

JAVAEE——SpringMVC第一天:介绍、入门程序、架构讲解、SpringMVC整合MyBatis、参数绑定、SpringMVC和Struts2的区别

1. 学习计划   第一天 1.SpringMVC介绍 2.入门程序 3.SpringMVC架构讲解 a) 框架结构 b) 组件说明 4.SpringMVC整合MyBatis 5.参数绑定 a) SpringMVC默认支持的类型 b) 简单数据类型 c) Pojo类型 d) Pojo包装类型 e) 自定义参数绑定 6.SpringMVC和Struts2的区别   第二天 1.高级参数绑定 a) 数组类型的参数绑定 b) List类型的绑定 2.@RequestMapping注解的使用 3.Con

如何搭建高可用redis架构?

1 题记 Redis 是一个开源的使用 ANSI C 语言编写.支持网络.可基于内存亦可持久化的日志型.Key-Value 数据库,并提供多种语言的 API. 如今,互联网业务的数据正以更快的速度在增长,数据类型越来越丰富,这对数据处理的速度和能力提出了更高要求.Redis 是一种开源的内存非关系型数据库,给开发人员带来的体验是颠覆性的.在自始至终的设计过程中,都充分考虑高性能,这使得 Redis 成为当今速度最快的 NoSQL 数据库. 考虑高性能的同时,高可用也是很重要的考虑因素.互联网 7

【转】Spring+Mybatis+SpringMVC+Maven+MySql搭建实例

林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要讲了如何使用Maven来搭建Spring+Mybatis+SpringMVC+MySql的搭建实例,文章写得很详细,有代码有图片,最后也带有运行的效果. 本文工程免费下载 一.准备工作 1. 首先创建一个表: CREATE TABLE `t_user` ( `USER_ID` int(11) NOT NULL AUTO_INCREMENT, `USER_NAME` char(3

Spring+Mybatis+SpringMVC+Maven+MySql搭建实例

林炳文Evankaka原创作品.转载请注明出处http://blog.csdn.net/evankaka 摘要:本文主要讲了如何使用Maven来搭建Spring+Mybatis+SpringMVC+MySql的搭建实例,文章写得很详细,有代码有图片,最后也带有运行的效果. 一.准备工作 1. 首先创建一个表: CREATE TABLE `t_user` ( `USER_ID` int(11) NOT NULL AUTO_INCREMENT, `USER_NAME` char(30) NOT NU

Springmvc 整合 jetbrick 实例

应用环境:  <jetbrick.version>1.2.8</jetbrick.version> <antlr4-runtime.version>4.2.2</antlr4-runtime.version> <spring.mybatis.common.version>2.0</spring.mybatis.common.version> 项目结构: 实例展示: 1.引如pom依赖 <project xmlns="h