1.规范
如果有被HTTP劫持的可能,必须使用HTTPS.移动端使用的H5页面被劫持的可能性很大.
各服务私有DB库表不允许在线业务跨服务直读取.
不要将公司代码上传到Github等公网代码管理网站上.
2.代码管理
版本管理:Git
协作流程:Git flow或者Github flow
工作流程:查看后面的Git工作流程规范
3.技术栈
缓存:
分布式缓存:Redis采用4.x版本,集群基于Sentinel或Cluster
本地缓存:Guava
NoSQL:
支持复杂的JSON结构,JSON查询和持久化,推荐使用MongoDB.支持简单的数据类型,推荐使用Redis.
数据库: MySQL: 5.7 or upper
搜索引擎: ES: 6.5 or upper
消息队列:Kafka
Kafka的消息,如果是给外部系统用的,使用JSON.如果是内部系统内部用并且对性能要求高,使用Google的Protobuf.用Java做Kafka的研发,不要使用Spring的封装,直接使用Kafka的API.
Web容器: Tomcat 8.5 or upper
PRC: gRPC或者dubbo
4.Java
Build tool: Gradle, Maven
IDE: IntelliJ IDEA
Java version: 1.8 or upper
JDK: Oracle JDK 8u202是Oracle JDK8最后一个免费的update,统一使用8u202或者8u202以前的Oracle JDK 8.
Library:
1.Guava
2.Apache Commons library
3.Hutool
JSON:Jackson
Test:JUnit, Google Truth
Mock Test Framework: Mockito, powerMock
Logging: Log4j2, slf4j, Logback
Schedule: XXL-JOB
5.Spring
Spring boot
Security framework: Spring Security
Spring Cloud:
Registry Center: Nacos
Config Center: Nacos
RestFul: Open Feign
Gateway: Gateway(Zuul), APISIX
Flow control: Sentinel
Latency and Fault Tolerance(Circuit Breaker):Resilience4j
Distributed Transaction: Seata
Distributed tracing: Spring Cloud Sleuth + ZipKin, Jaeger
6.MySQL
ORM: MyBatis-plus
Connection Pool: Druid, Hikari
Redis: Lettuce, Jedis
Distributed database middleware: Sharding Sphere
7.api文档
API and Doc: Swagger + Yapi
8.其他
系统间访问,RESTful或者gRPC
9.大数据
实时分析:Spark Streaming
离线分析:Spark
语言:Java, Scala
大宽表:HBase
a.代码样式
使用google-java-format,
即https://github.com/google/google-java-format.
打开Preferences->Java->Code Style->Organize Imports, 设定import顺序为: com java javax org