项目mybatis操作数据库参考:
http://how2j.cn/k/springboot/springboot-mybatis/1649.html?p=78908
junit对controller层测试参考:
mysql版本:5.5.62
1、kotlin版springboot项目创建
访问https://start.spring.io/, 创建项目demo(maven + kotlin + springboot 2.1.7, 其他默认)。
2、创建数据库及表
create database test;
use test;
CREATE TABLE category_ (
idint(11) NOT NULL AUTO_INCREMENT,
name varchar(30),
PRIMARY KEY (id)
) DEFAULT CHARSET=UTF8;
insert into category_ values(null, 'Aa');
insert into category_ values(null, 'Bb');
insert into category_ values(null, 'Cc');
insert into category_ values(null, 'Dd');
insert into category_ values(null, 'Ee');
insert into category_ values(null, 'Ff');
insert into category_ values(null, 'Gg');
insert into category_ values(null, 'Hh');
insert into category_ values(null, 'Ii');
insert into category_ values(null, 'Jj');
insert into category_ values(null, 'Kk');
insert into category_ values(null, 'Ll');
insert into