TbUser.java和TbUserExample.java,TbUserMapper.java,TbUserMapper.xml由mybatis框架生成。

generatorConfig.xml

 <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE generatorConfiguration
PUBLIC "-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN"
"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd">
<generatorConfiguration>
<!-- 引入配置文件 -->
<!--<properties resource="jdbc.properties"/>-->
<properties url="file:///D:\IDEASpace\market\market-dao\src\main\resources\jdbc.properties"/>
<context id="marketTables" targetRuntime="MyBatis3">
<commentGenerator>
<!-- 是否去除自动生成的注释 true:是 : false:否 -->
<property name="suppressAllComments" value="true" />
</commentGenerator>
<!--数据库连接的信息:驱动类、连接地址、用户名、密码 -->
<jdbcConnection driverClass="${JDBC_DRIVER}"
connectionURL="${JDBC_URL}"
userId="${JDBC_USERNAME}" password="${JDBC_PASSWORD}">
</jdbcConnection>
<!-- 默认false,把JDBC DECIMAL 和 NUMERIC 类型解析为 Integer,为 true时把JDBC DECIMAL
和 NUMERIC 类型解析为java.math.BigDecimal -->
<javaTypeResolver>
<property name="forceBigDecimals" value="false" />
</javaTypeResolver>
<!-- targetProject:生成PO类的位置 -->
<javaModelGenerator targetPackage="io.guangsoft.market.bean"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
<!-- 从数据库返回的值被清理前后的空格 -->
<property name="trimStrings" value="true" />
</javaModelGenerator>
<!-- targetProject:mapper映射文件生成的位置 -->
<sqlMapGenerator targetPackage="io.guangsoft.market.mapper"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</sqlMapGenerator>
<!-- targetPackage:mapper接口生成的位置 -->
<javaClientGenerator type="XMLMAPPER" targetPackage="io.guangsoft.market.dao"
targetProject="src/main/java">
<!-- enableSubPackages:是否让schema作为包的后缀 -->
<property name="enableSubPackages" value="false" />
</javaClientGenerator>
<!-- 指定数据库表 -->
<table schema="" tableName="tb_content"></table>
<table schema="" tableName="tb_content_category"></table>
<table schema="" tableName="tb_item"></table>
<table schema="" tableName="tb_item_cat"></table>
<table schema="" tableName="tb_item_desc"></table>
<table schema="" tableName="tb_item_param"></table>
<table schema="" tableName="tb_item_param_item"></table>
<table schema="" tableName="tb_order"></table>
<table schema="" tableName="tb_order_item"></table>
<table schema="" tableName="tb_order_shipping"></table>
<table schema="" tableName="tb_user"></table>
</context>
</generatorConfiguration>

spring-jedis.xml

 <?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:context="http://www.springframework.org/schema/context" xmlns:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd">
<!-- 解析properties文件的工具类 -->
<context:property-placeholder location="classpath:*.properties"/>
<!-- 连接池配置 -->
<bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig">
<!-- 最大连接数 -->
<property name="maxTotal" value="30" />
<!-- 最大空闲连接数 -->
<property name="maxIdle" value="10" />
<!-- 每次释放连接的最大数目 -->
<property name="numTestsPerEvictionRun" value="1024" />
<!-- 释放连接的扫描间隔(毫秒) -->
<property name="timeBetweenEvictionRunsMillis" value="30000" />
<!-- 连接最小空闲时间 -->
<property name="minEvictableIdleTimeMillis" value="1800000" />
<!-- 连接空闲多久后释放, 当空闲时间>该值 且 空闲连接>最大空闲连接数 时直接释放 -->
<property name="softMinEvictableIdleTimeMillis" value="10000" />
<!-- 获取连接时的最大等待毫秒数,小于零:阻塞不确定的时间,默认-1 -->
<property name="maxWaitMillis" value="1500" />
<!-- 在获取连接的时候检查有效性, 默认false -->
<property name="testOnBorrow" value="true" />
<!-- 在空闲时检查有效性, 默认false -->
<property name="testWhileIdle" value="true" />
<!-- 连接耗尽时是否阻塞, false报异常,ture阻塞直到超时, 默认true -->
<property name="blockWhenExhausted" value="false" />
</bean> <!-- 配置jedisPool对象 -->
<bean id="jedisPool" class="redis.clients.jedis.JedisPool">
<constructor-arg name="host" value="${JEDIS_URL}" />
<constructor-arg name="port" value="${JEDIS_PORT}" />
<constructor-arg name="poolConfig">
<ref bean="jedisPoolConfig"/>
</constructor-arg>
</bean> <bean id="jedisDaoPool" class="io.guangsoft.market.dao.jedis.JedisDaoImpl">
<property name="pool">
<ref bean="jedisPool"/>
</property>
</bean>
</beans>

jedis.properties

 JEDIS_URL=127.0.0.1
JEDIS_PORT=6379

JedisDao.java

 package io.guangsoft.market.dao.jedis;

 public interface JedisDao {
public String set(String key,String value);
public String get(String key);
public Long expire(String key, int seconds);
public Long ttl(String key);
public Long hset(String key,String hkey,String value);
public String hgetI(String key,String hkey);
public Long del(String key);
public Long hdel(String key,String hkey);
}

JedisDaoImpl.java

 package io.guangsoft.market.dao.jedis;

 import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool; public class JedisDaoImpl implements JedisDao { private JedisPool pool; public JedisPool getPool() {
return pool;
} public void setPool(JedisPool pool) {
this.pool = pool;
} @Override
public String set(String key, String value) {
Jedis jedis = pool.getResource();
String val = jedis.set(key, value);
jedis.close();
return val;
} @Override
public String get(String key) {
Jedis jedis = pool.getResource();
String val = jedis.get(key);
jedis.close();
return val;
} @Override
public Long expire(String key, int seconds) {
Jedis jedis = pool.getResource();
Long val = jedis.expire(key, seconds);
jedis.close();
return val;
} @Override
public Long ttl(String key) {
Jedis jedis = pool.getResource();
Long val = jedis.ttl(key);
jedis.close();
return val;
} @Override
public Long hset(String key, String hkey, String value) {
Jedis jedis = pool.getResource();
Long val = jedis.hset(key, hkey, value);
jedis.close();
return val;
} @Override
public String hgetI(String key, String hkey) {
Jedis jedis = pool.getResource();
String val = jedis.hget(key, hkey);
jedis.close();
return val;
} @Override
public Long del(String key) {
Jedis jedis = pool.getResource();
Long val = jedis.del(key);
jedis.close();
return val;
} @Override
public Long hdel(String key, String hkey) {
Jedis jedis = pool.getResource();
Long val = jedis.hdel(key, hkey);
jedis.close();
return val;
}
}

基于SSM的单点登陆03的更多相关文章

  1. 基于SSM的单点登陆01

    使用SSM的Maven聚合项目 建立父项目market的pom文件 <?xml version="1.0" encoding="UTF-8"?> & ...

  2. 基于SSM的单点登陆04

    jdbc.properties JDBC_DRIVER=org.mariadb.jdbc.Driver JDBC_URL=jdbc:mariadb://127.0.0.1:3306/market JD ...

  3. 基于SSM的单点登陆05

    springmvc.xml <?xml version="1.0" encoding="UTF-8"?> <beans xmlns=" ...

  4. 基于SSM的单点登陆02

    pom文件 <?xml version="1.0" encoding="UTF-8"?> <project xmlns="http: ...

  5. Spring Security 解析(六) —— 基于JWT的单点登陆(SSO)开发及原理解析

    Spring Security 解析(六) -- 基于JWT的单点登陆(SSO)开发及原理解析   在学习Spring Cloud 时,遇到了授权服务oauth 相关内容时,总是一知半解,因此决定先把 ...

  6. 集成基于OAuth协议的单点登陆

    在之前的一篇文章中,我们已经介绍了如何为一个应用添加对CAS协议的支持,进而使得我们的应用可以与所有基于CAS协议的单点登陆服务通讯.但是现在的单点登陆服务实际上并不全是通过实现CAS协议来完成的.例 ...

  7. 集成基于CAS协议的单点登陆

    相信大家对单点登陆(SSO,Single Sign On)这个名词并不感到陌生吧?简单地说,单点登陆允许多个应用使用同一个登陆服务.一旦一个用户登陆了一个支持单点登陆的应用,那么在进入其它使用同一单点 ...

  8. 基于SAML的单点登录介绍

    http://blog.csdn.net/csethcrm/article/details/20694993 一.背景知识: SAML即安全断言标记语言,英文全称是Security Assertion ...

  9. (转)基于SAML的单点登录介绍

    转:http://www.cnblogs.com/zsuxiong/archive/2011/11/19/2255497.html 一.背景知识: SAML即安全断言标记语言,英文全称是Securit ...

随机推荐

  1. 嵌入式开发之赛灵思 xilinx Zynq芯片简介---Zynq-7000 EPP (XC7Z010 and XC7Z020)

    (1)企业简介 作为DSP 和视频应用领域的头号 FPGA 供应商,赛灵思致力于通过其目标设计平台提供业内领先的 DSP 开发工具.方法.IP 和技术支持.赛灵思面向 DSP 的目标设计平台将这些元素 ...

  2. point-position2修改版

    说明: 在共面直线测试中,由于计算误差等原因,共面条件判断不准,但计算结果依然正确. // point-position2.cpp : 定义控制台应用程序的入口点. #include "st ...

  3. python3----转换大小写(upper lower capitalize and title)

    和其他语言一样,Python为string对象提供了转换大小写的方法:upper() 和 lower().还不止这些,Python还为我们提供了首字母大写,其余小写的capitalize()方法,以及 ...

  4. OpenCV学习笔记九:opencv_stitching模块

    一,简介: 该库用于图像拼接.

  5. TOC之关键链项目管理遇到软件project7原则

    编著者:张克强    微博:张克强-敏捷307 软件project7原则简单介绍 美国著名软件project专家鲍伊姆(B.W.Boehm,也又另译为勃姆)在总结软件project准则和信条的基础上, ...

  6. Android Studio3.0 配置ButterKnife出错的解决

    需要注意的问题: (1)ButterKnife.bind(this);必须在设置布局之后进行初始化: 官方升级到了8.8.1了 compile 'com.jakewharton:butterknife ...

  7. Uvalive6885(最短路)

    题目链接:http://acm.hust.edu.cn/vjudge/problem/viewProblem.action?id=129723 题目大意:n个点,m条边,求出从0到n的最短距离,输出途 ...

  8. 部署vuejs dist文件,通过node.js编译

    前期准备: 1. Linux环境,安装配置node.js ① 下载地址:http://nodejs.cn/download/  ,下载linux 64位 ② 已编译好的压缩包,解压到指定目录 cd / ...

  9. 【转】再谈CLR查找和加载程序集的方式

    这是一个老问题,以前也有朋友写过一些文章介绍,但可能还不是很全面.我也多次被人问到,这里结合案例再次谈谈,希望对大家有所帮助. 本文范例代码可以通过这里下载 http://files.cnblogs. ...

  10. DRDS和RDS主要用来存储用户交易信息,MongoDB主要用来存储商品维度信息

    数据集成Data Integration-数加-大数据-阿里云 https://www.aliyun.com/product/cdp 数据集成支持的数据源 数据源类型 数据源 来源数据源被读取 目标数 ...