本教程架构当前较流行的 Java 技术:
Spring Boot、MVC 、Security + Mybatis + Mysql + Thymeleaf
安装工具:
- JDK 14
记得配置 JAVA_HOME
- Maven
settings 内追加阿里镜像<mirror> <id>nexus-aliyun</id> <mirrorOf>*</mirrorOf> <name>Nexus aliyun</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> </mirror>
- STS(Spring Tools 4 for Eclipse)
- Mysql(下载 Xampp 会方便些)
创建 Demo 数据库及 users、shirts 表:
CREATE TABLE `users` ( `id` int(11) NOT NULL, `username` varchar(20) NOT NULL, `password` text NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `users` (`id`, `username`, `password`) VALUES (1, 'admin', '$2a$10$KcW2MFF0f3EOFT9auZ4RtuVA7/jrw9Uv.yYJV0/hBn5DgCZ1tz9ry'); ALTER TABLE `users` ADD PRIMARY KEY (`id`); ALTER TABLE `users` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3; COMMIT; CREATE TABLE `shirts` ( `id` int(11) NOT NULL, `name` varchar(50) NOT NULL, `size` int(11) NOT NULL, `color` varchar(20) NOT NULL, `Create_time` datetime NOT NULL ) ENGINE=InnoDB DEFAULT CHARSET=utf8; INSERT INTO `shirts` (`id`, `name`, `size`, `color`, `Create_time`) VALUES (1, 'A', 35, 'Black', '2020-06-10 00:00:00'), (2, 'B', 36, 'Yellow', '2020-06-25 00:00:00'); ALTER TABLE `shirts` ADD PRIMARY KEY (`id`); ALTER TABLE `shirts` MODIFY `id` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;