# Java后端开发手册 ### 技术栈介绍 | 模块 | 主键 | | ------------ | ------------------------------------------------------------ | | 核心框架 | spring boot 2.1.2.RELEASE | | 安全框架 | spring security 2.1.2.RELEASE | | 注册中心 | eureka | | 网关 | spring cloud gateway | | 服务监控 | spring boot admin | | 请求链追踪 | zipkin-server 2.12.0 | | 服务间调用 | feign 10.1.0 | | http框架 | okhttp3 | | 表单校验 | hibernate-validator 6.0.14.Final | | 数据库连接池 | druid 1.1.10 | | 持久层 | mybatis 3.4.6 | | 缓存框架 | spring-data-redis 2.1.4.RELEASE、lettuce 5.1.3.RELEASE | | 日志管理 | logback 1.2.3、slf4j 1.7.25 | | 定时任务 | quartz 2.3.0 | | 工作流引擎 | flowable 6.4.1 | | 消息队列 | rocketMQ | | 性能测试框架 | contiperf 2.3.4 | | 验证码 | kaptcha 2.3.2 | | 配置文件加密 | jasypt 2.1.1 | | 工具类 | lombok 1.18.2、joda-time 2.10.1、easyexcel 1.1.2-beta5、commons-lang3 3.3.2、pinyin4j 2.5.1、pagehelper 5.1.8、swagger 2.9.2 | ### 基础环境 操作系统:Ubuntu 18.04.1 LTS 代码仓库:Git 2.17.1 发版构建工具:Jenkins ver. 2.150.1、JDK 1.8.0_191、Maven 3.6.0 接口文档管理:YApi 1.4.3、Swagger 2.9.2 Maven私服:Nexus 3.15.2-01 ### 代码生成器介绍 项目:wisdom-generator 使用spring boot + velocity模板引擎实现,根据已设计好的表结构,完成dao、service、controller三层代码自动生成,并同时生成swagger文档以及基础的表单校验 ### 项目工程介绍 ##### 框架 * wisdom-common (共通包,共通配置、工具类、通用bean) http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-common.git * wisdom-ds (动态数据源)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-ds.git * wisdom-monitor (spring cloud服务监控)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-monitor.git * wisdom-track (服务调用链追踪)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-track.git * wisdom-gateway (服务网关)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-gateway.git * wisdom-center (服务注册中心)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-center.git * wisdom-parent (父pom,管理依赖包版本)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-parent.git ##### 业务 * wisdom-asset (资产管理系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-asset.git * wisdom-bill (账单管理系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-bill.git * wisdom-platform (平台系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-platform.git * wisdom-serve (物业服务系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-serve.git * wisdom-payment (支付网关)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-payment.git * wisdom-auth (授权中心)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-auth.git * wisdom-flow (工作流模块)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-flow.git * wisdom-push (推送系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-push.git * wisdom-file (文件系统)http://git.wisdomcity.com.cn/WisdomCity-JAVA/wisdom-file.git ### 开发步骤 1. 原型评估 2. 接口设计及接口文档编写 3. 数据库表设计 4. 代码生成 5. 代码编写完善 6. 功能发版 7. 与前端联调 8. 交付测试,bug跟踪 ### 项目工程基础配置 ##### maven私服配置 ```xml D:/usr/bin/Java/apache-maven-3.5.2/maven-dependcies wisdom admin WisdomCity@2019 wisdom central http://139.159.210.228:8081/repository/maven-public/ spring spring-milestones http://139.159.210.228:8081/repository/spring-milestones/ wisdom central http://central true true always warn central http://central true true always warn spring-milestones spring-milestones https://spring true false spring-milestones https://spring true false wisdom spring-milestones ``` ##### pom配置 ```xml com.wisdom wisdom-cloud-parent 1.0.0-SNAPSHOT wisdom-xxx org.springframework.boot spring-boot-maven-plugin ``` ##### SwaggerConfig ```java @Configuration @EnableSwagger2 public class SwaggerConfig { @Bean public Docket createRestApi() { return new Docket(DocumentationType.SWAGGER_2) .apiInfo(apiInfo()) .select() .apis(RequestHandlerSelectors.basePackage("com.wisdom.xxx.web")) .paths(PathSelectors.any()) .build(); } private ApiInfo apiInfo() { return new ApiInfoBuilder() .title("xxx系统") .description("xxx系统") .termsOfServiceUrl("http://wuye.huiguanjia.cn") .version("1.0") .build(); } } ``` ##### 开发约定 详见:[Java开发约定]:http://doc.huiguanjia.cn/markdown/content/router?filePath=/tmp/docs/develop/规范/Java后端/Java后端开发规范.md&code=null