/start

随着工作经验的积累,在工作和私有项目中越来越多的项目需要开始启动,而重复的内容使我厌烦,同时维护很多版本的代码。 这个项目就产生了,它不是一个完整的项目而是作为模板项目、代码基线而存在,在我未来的工作和私有项目都将以此项目作为基线版本,在此之上增加各自的业务代码。

Primary LanguageJavaApache License 2.0Apache-2.0

English | 简体中文

start

start

Actions Status travis-ci Coverage Status codebeat badge license

With the accumulation of work experience, more and more projects in work and private projects need to be started, and the repetitive content bores me, while maintaining many versions of the code. This project was born. It is not a complete project but exists as a template project and a code baseline. In my future work and private projects, I will use this project as the baseline version and add my own business code on top of it.

Project Repository

Technology Selection

Spring Boot

Spring , this is no need to explain, this reason is enough. This has nothing to do with Spring's IoC, DI, and AOP. The trend in the industry is to use Spring. It must be Spring Boot. I don’t want to toss a bunch of XML configuration files.

Mybatis

Foreigners like Spring Data JPA, and Chinese prefer Mybatis. JPA is very good, but the design idea of JPA is based on domain-driven design. The premise is that your database table structure model is designed according to the specification of domain-driven design, and then use ORM to map into objects, OOP programming, so that it is well isolated. The difference between different databases. But what is the domestic situation? Everyone is programming for leaders, and the needs are changing every day. There is no domain expert to design the model, the database structure is messy, and many scenarios require us to write SQL to implement, so I chose Mybatis.

Druid

Spring Boot 2.x uses HikariCP connection pool by default, but I chose Alibaba's Druid. HiKariCP is fast and has high performance. It is biased towards performance. Druid is more inclined to monitoring and data access behavior enhancement (WallFilter can prevent SQL injection, StatFilter can perform performance monitoring, LogFilter can output SQL logs), and Alibaba has experience in Taobao's high concurrency big data, I believe in Druid's security and stability.

Security warning

Spring Security

Because I have implemented the FilterInvocationSecurityMetadataSource and AccessDecisionManager interfaces, in order to achieve dynamic reading of roles and permissions from the database. But this leads to the failure of @PreAuthorize! At the same time, the configuration will be invalid. For details, please refer to the code of net.renfei.security.interceptor.AccessDecisionManagerImpl.decide, and add the address of the resource you want to protect. The database tables involved are: t_start_permission resource table, t_start_role role table, t_start_role_permission role and resource association table, only resource addresses in these three tables Will be protected.