今天开始学习SpringBoot+SpringSecurity的权限系统
笔记①
采用 Maven聚合工程模块 的开发方法
最终服务器端架构模块
auth-parent:根目录,管理子模块:
common:公共类父模块
common-log:系统操作日志模块
common-util:核心工具类
service-util:service模块工具类
spring-security:spring-security业务模块
model:实体类模块
service-system:系统权限模块
笔记②
下面是对junit的补充
如图,我们使用的是junit5
import org.junit.jupiter.api.Test;
引入这个包 就不会出错!
当我们引入的是其他的junit包
org.junit
则表示引入的是 junit4 还需要引入其他的注解配合使用 ,较为繁琐!
笔记③
当我们在SpringBoot启动类设置了
@MapperScan("com.tong.mapper")
我们在之后的mapper类中,则不需要添加注解@Mapper,可以换成@Repository
@Mapper让Mapper的实现类能被启动类扫描同时创建bean,启动类上有@MapperScan了就只需要注册bean了,故我们只需要添加@Repository即可。
笔记④
@TableId(type = IdType.ASSIGN_ID) //默认的ID算法 雪花算法!
笔记⑤
MP(MybatisPlus)实现Service
@Service public class SysRoleServiceImpl extends ServiceImpl<SysRoleMapper, SysRole> implements SysRoleService { }
在该ServiceImpl中可以不用自动注入mapper,原因如下源码: