Gradle 依赖指南
基础依赖
- org.springframework.boot:spring-boot-starter-parent:${version}
- 引入此依赖后,其他依赖就不需要再指定依赖版本了,会自动引入最合适的依赖版本
- ${version}与springboot版本保持一致
- org.springframework.boot:spring-boot-starter-web
- org.springframework.boot:spring-boot-starter-test
- org.projectlombok:lombok(可选,推荐)
- org.springframework.boot:spring-boot-devtools
- 主要是支持热部署
- 只引入此依赖无法生效,需要勾选preferences->Build, Execution, Deployment->compiler->build project automatically
- 在springboot启动器中add run options,选择On Update action(代码变动时)/On frame deactivation(失去焦点时),选择更新classes and resources
- org.springframework.boot:spring-boot-configuration-processor
- 支持自定义配置文件 => spring-configuration-metadata.json(配置spring的元数据)
- 支持.properties、.yml文件
- .yml比.properties先加载,因此.proerties的配置内容会覆盖.yml
- 在项目中,尽可能的使用统一的配置文件类型
其他依赖
cglib:cglib:3.3.0 Cglib动态代理
com.alibaba:fastjson:1.2.58 Alibaba Fastjson
com.aliyun:ecs20140526:3.1.12 Aliyun SDK
com.aliyun:alibabacloud-dysmsapi20170525:2.0.23 Aliyun 短信SDK
implementation 'redis.clients:jedis:4.4.3' jedis
- springboot继承redis
implementation 'org.springframework.boot:spring-boot-starter-data-redis:2.1.4.RELEASE'
implementation 'org.springframework.data:spring-data-redis:2.1.4.RELEASE'
build.gradle配置说明
- dependencies中的各种用法