- 项目结构

| microservice-parent: 统一管理所有模块的 jar 包版本信息 |
| microservice-bean: 统一管理所有模块的用到的 pojo 类 |
| microservice-common:统一管理所有模块的用到的工具类、枚举类、异常处理、日志文件、统一返回结果信息 |
| microservice-service: 统一封装所有的微服务 |
| microservice-gateway: 封装网关信息 |
| rootProject.name = 'microservice' |
| include 'microservice_bean' |
| include 'microservice_common' |
| include 'microservice_gateway' |
| include 'microservice_service' |
| include 'microservice_service:service_user' |
| |
| findProject(':microservice_service:service_user')?.name = 'service_user' |
| include 'microservice_service:service_order' |
| findProject(':microservice_service:service_order')?.name = 'service_order' |
| |
| ext { |
| version = [ |
| "fastjsonVersion" : "1.2.72", |
| "mybatisPlus" : "3.0.5", |
| "mysql" : "5.1.46", |
| "swaggerVersion": "2.7.0", |
| "jjwtVersion": "0.7.0" |
| ] |
| |
| dependencies = [ |
| "fastjson" : "com.alibaba:fastjson:${version.fastjsonVersion}", |
| "mybatis-plus-boot-starter" : "com.baomidou:mybatis-plus-boot-starter:${version.mybatisPlus}", |
| "mysql" : "mysql:mysql-connector-java:${version.mysql}", |
| "swagger" : "io.springfox:springfox-swagger2:${version.swaggerVersion}", |
| "swaggerUI" : "io.springfox:springfox-swagger-ui:${version.swaggerVersion}", |
| "jjwt" : "io.jsonwebtoken:jjwt:${version.jjwtVersion}" |
| ] |
| } |
| description '尚硅谷gradle微服务实战父工程' |
| |
| |
| buildscript { |
| ext { |
| springBootVersion = '2.2.1.RELEASE' |
| springCloudVersion = 'Hoxton.RELEASE' |
| springCloudAlibabaVersion = '0.2.2.RELEASE' |
| } |
| |
| |
| repositories { |
| maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } |
| maven { url 'https://repo.spring.io/milestone'} |
| } |
| |
| dependencies { |
| classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}") |
| } |
| } |
| |
| |
| allprojects { |
| group 'com.atguigu' |
| version '1.0-SNAPSHOT' |
| |
| |
| tasks.withType(JavaCompile) { |
| options.encoding = "UTF-8" |
| } |
| |
| |
| repositories { |
| maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' } |
| maven { url 'https://repo.spring.io/milestone'} |
| } |
| |
| } |
| |
| apply from: 'version.gradle' |
| |
| |
| subprojects { |
| |
| apply plugin: 'java' |
| apply plugin: 'java-library' |
| apply plugin: 'io.spring.dependency-management' |
| |
| sourceCompatibility= JavaVersion.VERSION_1_8 |
| targetCompatibility= JavaVersion.VERSION_1_8 |
| |
| |
| dependencies { |
| testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.1' |
| testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.1' |
| } |
| |
| test { |
| useJUnitPlatform() |
| } |
| |
| |
| dependencyManagement { |
| dependencies { |
| for(depJar in rootProject.ext.dependencies){ |
| dependency depJar.value |
| } |
| } |
| imports { |
| mavenBom "org.springframework.cloud:spring-cloud-dependencies:${springCloudVersion}" |
| mavenBom "org.springframework.cloud:spring-cloud-alibaba-dependencies:${springCloudAlibabaVersion}" |
| } |
| } |
| } |
| |
| project(':microservice_bean'){ |
| description("尚硅谷微服务实战之bean层:存放表对应的实体类") |
| } |
| |
| project(":microservice_common"){ |
| description("尚硅谷微服务实战之公共模块:存放微服务常用的工具类") |
| |
| dependencies { |
| api 'com.alibaba:fastjson' |
| api 'mysql:mysql-connector-java' |
| api 'com.baomidou:mybatis-plus-boot-starter' |
| api 'io.springfox:springfox-swagger2' |
| api 'io.springfox:springfox-swagger-ui' |
| api 'io.jsonwebtoken:jjwt' |
| |
| api 'org.springframework.cloud:spring-cloud-starter-openfeign' |
| api 'org.springframework.cloud:spring-cloud-starter-alibaba-sentinel' |
| api 'org.springframework.cloud:spring-cloud-starter-alibaba-nacos-discovery' |
| |
| } |
| } |
| |
| project(":microservice_service"){ |
| description("尚硅谷微服务实战之服务模块:存放各个微服务模块") |
| apply plugin: 'org.springframework.boot' |
| |
| subprojects { |
| apply plugin : 'java-library' |
| apply plugin: 'org.springframework.boot' |
| |
| dependencies { |
| api 'org.springframework.boot:spring-boot-starter-web' |
| api project(':microservice_bean') |
| api project(':microservice_common') |
| } |
| } |
| |
| } |
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 10年+ .NET Coder 心语 ── 封装的思维:从隐藏、稳定开始理解其本质意义
· 【设计模式】告别冗长if-else语句:使用策略模式优化代码结构
· 字符编码:从基础到乱码解决
· 提示词工程——AI应用必不可少的技术