一、配置Maven omcat
https://www.cnblogs.com/Miracle-Maker/articles/6476687.html
https://www.cnblogs.com/Knowledge-has-no-limit/p/7240585.html
二、创建数据库表
DROP DATABASE IF EXISTS sampledb; CREATE DATABASE sampledb DEFAULT CHARACTER SET utf8; USE sampledb; #创建用户表 CREATE TABLE t_user ( user_id INT AUTO_INCREMENT PRIMARY KEY, user_name VARCHAR(30), credits INT, `password` VARCHAR(32), last_visit DATETIME, last_ip VARCHAR(23) )ENGINE=INNODB; INSERT INTO t_user(user_name,`password`) VALUES('admin','123456'); #创建用户登录日志表 CREATE TABLE t_login_log ( login_log_id INT AUTO_INCREMENT PRIMARY KEY, user_id INT, ip VARCHAR(23), login_datetime DATETIME )ENGINE=INNODB;
三、代码
见《精通Spring4.X企业应用开发实战》第二章代码