Introduction to JeecgBoot
JeecgBoot是一款基于代码生成器的低代码开发平台,零代码开发!前端采用Ant Design&Vue,后端集成了SpringBoot2.x,Mybatis-plus,安全框架为Shiro,JWT。相对其他开源项目比较出色的是在线配置表单、在线配置报表、在线图表设计、在线设计流程、在线设计表单,极大的提高了开发效率,另外,jeecg-boot拥有强大的代码生成逻辑,相对于其他开源框架来说,jeecg-boot的代码生成能用于开发较复杂的联表查询而不是只能实现单表查询的简单逻辑。
Experience of using jeecg-boot
- The first time I use JeecgBoot, I feel that the configuration is relatively simple, the database and redis are simply configured, the project is started with one click, and there are detailed documents for project deployment (war package deployment, jar package deployment, docker deployment, etc.), and the operation of the project , The deployment basically does not encounter problems; in terms of database, the table name is relatively standardized, and each table has five fields del_flag, create_time, create_by, update_time, and update_by, which record the data migration of the table in an all-round way;
- JeecgBoot project monitoring is relatively complete, including routing gateway monitoring, timing task monitoring, redis monitoring, log monitoring, data log monitoring, performance monitoring, SQL monitoring, etc., which can display project conditions in real time, predict project downtime risks in advance, and improve project operations. Dimension level
- JeecgBoot has a better detail, that is, the system notification system management-system notification interface. When adding system notifications, editing the specific content of the notification can typeset the content of the notification, which is convenient for the company to use, and the notifications issued look more formal;
JeecgBoot integrates the multi-tenant mode. We all know that there are three implementation modes for multi-tenant. One is to isolate data based on tenant_id, the other is to isolate data based on Schema (oracle support is better), and the third is to isolate independent databases (the highest security); the one used by JeecgBoot It is the tenant_id mode isolation with the most difficult development but the least resource consumption. The specific implementation process is to query the user's tenant_id after logging in, and put this tenant_id into the front-end vuex state tree so that every time the back-end interface is accessed, the tenant_id is attached, and the front-end accesses the back-end. When the backend obtains the tenant_id, inject it into the ThreadLocal, and then configure the Mybatisplus paging plug-in. Each time you query the tenant_id extracted from the ThreadLocal to achieve multi-tenant data isolation; when developing new functions, you should pay attention to the table that requires multi-tenant mode. Add the tenant_id field, do not need multi-tenant data isolation tables or SQL must remember to configure tenantTable exclusions;
Suggestions for Improvement:
- The JeecgBoot configuration items are more complicated and dazzling, making Mengxin seem impossible to start. The solution:
Reduce the configuration items and keep only the most basic configuration. Other extended functions, such as enabling SMS, enabling object storage, etc., are written in the document, allowing users to read more documents and then raise issues or ask questions in the group, thus reducing developer work It also makes the project "lightweight"; - I noticed that some tables in JeecgBoot use the text data format, such as the data_content field of the sys_data_log of the log table, but there is no limit to the data length when entering the library. There is a risk here. When we have some abnormal data, the text format cannot be installed. At times there is a risk of downtime and will reduce server performance;
- JeecgBoot uses logical deletion itself, but logical deletion will conflict with the existing logic. For example, the existing user Zhang San, I deleted the user Zhang San, but for some reason I need to add the user Zhang San, then add When the user name already exists, I think this is a potential bug of logical deletion. The solution:
Give up logical deletion, create a new backup table, and copy the deleted data to the backup table, which avoids some code logic conflicts and saves the data;
Do not give up logical deletion, the logical deletion table adds a unique field based on the timestamp, and this field can be queried when judging whether it is a duplicate; - JeecgBoot's monitoring is very complete but lacks the alarm function. During my local development, due to the small hard disk of my computer, the disk occupancy rate has increased to 90%, but there is no alarm in the monitoring so that if it is a production environment, there will be a risk of downtime; In addition, the monitoring is relatively mechanical, such as redis monitoring. It does not highlight our more important performance indicators, namely instantaneous_ops_per_sec (average total number of requests processed per second), rejected_connections (connections that reach max_client and then limit), and does not calculate the cache hit rate, etc.; solution:
Professional matters are handed over to professional people. It is recommended to integrate prometheus, cooperate with grafana for monitoring functions, use existing grafana templates or develop special monitoring templates for jeecgboot, graphically display monitoring indicators and configuration alarms, and improve the degree of automated project operation and maintenance - Multi-tenant recommendations:
Realize tenant mode configuration, that is, configure the user's multi-tenant mode, 0 no tenant mode, 1 based on tenant_id isolation, 2 based on Schema isolation, 3 independent database mode;
The tenant_id isolation mode requires the development of a multi-tenant switch. When the user closes the multi-tenant, the front-end and back-end are forced to set the tenant_id to 1;
The easiest way to Schema isolation mode is to set the Schema name to have a tenant name;
The independent database model is based on multiple data sources, and tenants use different data sources (does not conflict with the main and standby data sources)
In addition, the logic of adding tenants for tenant management is too simple. After adding tenants, you should initialize necessary data for the tenants, such as initializing the administrator account, basic roles, positions, departments, data dictionary, etc.; - Tips on redis
JeecgBoot puts the cache in redis, but does not have a cache elimination strategy, which will cause a waste of resources in scenarios with too many users, so I suggest to enable redis's cache elimination strategy or write an LRU algorithm by myself.
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。