# spring-boot-reggie **Repository Path**: ifredom/spring-boot-reggie ## Basic Information - **Project Name**: spring-boot-reggie - **Description**: spring-boot-reggie - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2022-06-30 - **Last Updated**: 2022-07-29 ## Categories & Tags **Categories**: Uncategorized **Tags**: Java ## README # 工程简介 一个Springboot单体项目 + Mysql + mybatis + redis - Mysql :db文件夹 - 前端页面:resources/backend, resources/front - 代码生成器: [com.cool.reggie.config.AutoCodeGenerator](https://blog.csdn.net/win7583362/article/details/125556048) ## 访问 - 管理后台访问地址: http://localhost:8700/backend/index.html - 移动端访问地址: http://localhost:8700/front/page/login.html ## 功能 - 接口返回数据置空处理,返回得雪花算法生成Id使用Jackson序列化字符串 /core/config/WebMvcConfig - 异常管理:全局异常处理,自定义异常捕捉处理 /core/exception/GlobalExceptionHandle - Mybatis:自动填充字段 /core/mybatis/AutoFillField - Mybatis-plus: 分页 /config/MybatisPlusConfig - 实现一个Servlet服务器:/config/MyServlet [继承 HttpServlet,而非继承 GenericServlet。](https://www.bilibili.com/video/BV1Ga4y1Y7Ah?p=15) - 上传文件以及保存: http://localhost:8700/backend/page/demo/upload.html - 自定义唯一ID生成策略: [雪花漂移算法](https://github.com/yitter/idgenerator/tree/master/Java) - 统一处理 controller 返回数据格式: com.cool.reggie.core.interceptor.ResponseBodyWrapHandler - 使用Spring Redis Data : redis存取时,序列化value处理: com.cool.reggie.core.redis.RedisConfig - 使用Spring Cache: - 单元测试:Alt+K 1.[idea插件](https://plugins.jetbrains.com/plugin/10405-squaretest) 2.[Mockito数据模拟框架](https://github.com/imsingle/mockito-doc-zh) ## Mybatis 1. mybatis insert数据后,如何获取生成插入库中的id:添加 `useGeneratedKeys="true" keyProperty="id"` ```xml ``` ## redis 进行命令行页面 ```bash > D:\allsofoware\Redis-x64-3.0.504>.\redis-cli.exe -h 127.0.0.1 -p 6379 > keys * > select index[数字] 选择数据库 ``` ## Spring Cache - @EnableCaching 开启注解缓存 - @Cacheable 方法执行前,Spring查看缓存是否有数据,如果有则直接返回,没有则调用方法将数据存入缓存 - @CachePut 将方法返回值存入缓存 - @CacheEvict 删除一条或者多条缓存数据 ## screenshort ![Image text](https://gitee.com/ifredom/spring-boot-reggie/raw/master/screenshot/1.png) ![Image text](https://gitee.com/ifredom/spring-boot-reggie/raw/master/screenshot/2.png) ![Image text](https://gitee.com/ifredom/spring-boot-reggie/raw/master/screenshot/3.png) ![Image text](https://gitee.com/ifredom/spring-boot-reggie/raw/master/screenshot/4.png) ### 参考资料 - [B站视频地址](https://www.bilibili.com/video/BV13a411q753?p=11) - [Jackson配置大全](https://blog.csdn.net/Xiaowu_First/article/details/123846121) - [jacksonAPI文档](https://developer.adobe.com/experience-manager/reference-materials/6-4/javadoc/com/fasterxml/jackson/databind/DeserializationConfig.html#withoutFeatures-com.fasterxml.jackson.databind.DeserializationFeature...-) - [分布式Id生成策略](https://cloud.tencent.com/developer/article/2034844) - [雪花算法唯一ID生成方式](https://www.yisu.com/zixun/621017.html) - [7种测试框架](https://juejin.cn/post/7118546004148027406) - [spring cache使用](https://www.bilibili.com/video/BV13a411q753?p=166&vd_source=3c5672a416ac165826a145344ec5d29f) #### 拓展阅读 - [squaretest&Mockito 单元测试](https://juejin.cn/post/7119648755376209956?share_token=16629744-e268-46d3-b684-3ba242bf19d8)