spring boot+mybatis的登陆Demo

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_35529931/article/details/79087921

这周花了两天用spring boot+mybatis写了一个登陆功能的Demo.总结一下,分享一下。
在我的上一篇博客中介绍了如何创建springboot。这里就不介绍了
第一步:在resources下创建一个mapper文件夹,然后创建一个Mapper.xml;
这里写图片描述
第二步:依据分层,分别建立controller,service,dao,entity;
第三步:写实体类:
这里写图片描述
第四步:写dao接口:
这里写图片描述
第四步:写service接口:
这里写图片描述
第五步:写service实现:
这里写图片描述
第六步:写controller:
这里写图片描述
第七步:处理自定义错误:
这里写图片描述
第八步:引入logbakc-spring.xml文件,进行配置日志:
这里写图片描述
第九步:通过aop,进行写日志处理:
这里写图片描述
第十步:对登陆注册进行测试:
这里写图片描述
附录:Mapper.xml文件的内容:
这里写图片描述
好了,基本上流程就是这样的。
最后,附上我的Demo的代码:
链接:https://pan.baidu.com/s/1sm50G7z 密码:9au3
谢谢各位,如有不足,敬请谅解!

猜你喜欢

转载自blog.csdn.net/qq_35529931/article/details/79087921