oss
oss配置
<!--oss--> <dependency><groupId>com.aliyun.oss</groupId><artifactId>aliyun-sdk-oss</artifactId><version>3.6.0</version></dependency>
lombok
<!--lombok--><dependency><groupId>org.projectlombok</groupId><artifactId>lombok</artifactId><optional>true</optional></dependency>
redis redis配置
<!--redis--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency><dependency><groupId>org.apache.commons</groupId><artifactId>commons-pool2</artifactId></dependency>
es
<!--es--><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId><exclusions><exclusion><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId></exclusion><exclusion><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId></exclusion></exclusions></dependency><dependency><groupId>cn.easy-es</groupId><artifactId>easy-es-boot-starter</artifactId><version>2.0.0-beta1</version></dependency><dependency><groupId>org.elasticsearch.client</groupId><artifactId>elasticsearch-rest-high-level-client</artifactId><version>7.14.0</version></dependency><dependency><groupId>org.elasticsearch</groupId><artifactId>elasticsearch</artifactId><version>7.14.0</version></dependency>
nacos nacos配置
<!--nacos--><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
Spring Cloud的版本管理
<!--Spring Cloud的版本管理--><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-dependencies</artifactId><version>${spring.cloud.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-alibaba-dependencies</artifactId><version>${spring.cloud.alibaba.version}</version><type>pom</type><scope>import</scope></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId><version>2.3.0</version></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId><version>1.2.9</version></dependency><dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId><version>5.8.11</version></dependency><dependency><groupId>org.apache.httpcomponents</groupId><artifactId>httpclient</artifactId><version>4.5.13</version></dependency>
datasource 数据库配置
<!--datasource--><dependency><groupId>mysql</groupId><artifactId>mysql-connector-java</artifactId><scope>runtime</scope></dependency><dependency><groupId>com.alibaba</groupId><artifactId>druid-spring-boot-starter</artifactId></dependency><dependency><groupId>org.mybatis.spring.boot</groupId><artifactId>mybatis-spring-boot-starter</artifactId></dependency><dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId></dependency>
配置
数据库 datasource
#数据库
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
spring.datasource.url=jdbc:mysql://192.168.14.18:3306/three_group?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&allowMultiQueries=true
spring.datasource.username=root
spring.datasource.password=root123
Druid连接池
#Druid连接池
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.druid.initial-size=3
spring.datasource.druid.min-idle=3
spring.datasource.druid.max-active=20
spring.datasource.druid.max-wait=6000
mybatis
#mybatis
mybatis.mapper-locations=classpath:mapper/**.xml
mybatis.type-aliases-package=com.beimao.model
nacos nacos依赖
#-------------------------Nacos配置-bootstrap.properties---------------------------------
#------nacos地址------
spring.cloud.nacos.server-addr=192.168.14.221:8848
#------nacos配置名称------
spring.cloud.nacos.config.name=product-app
#------nacos命名空间id-----
spring.cloud.nacos.config.namespace = public
#------nacos默认组------
spring.cloud.nacos.config.group = DEFAULT_GROUP
#-------------------------Nacos服务发现注册中心配置------------------------------
spring.cloud.nacos.discovery.server-addr=192.168.14.221:8848
#spring.cloud.nacos.discovery.ip=192.168.14.11
spring.application.name = product-app
日志
#日志
logging.level.root=error
logging.level.com.beimao=debug
logging.pattern.console=%d{yyyy-MM-dd HH:mm:ss.SSS} %clr(%-5level) %clr([%X{traceId}]) %clr(${PID:-}) --- %clr(%logger{50}) - %m%n
饥饿加载
#----------开启饥饿加载
ribbon.eager-load.enabled=truespring.application.name=order1-app
server.port=8080
feign
# -------------- Feign 配置 --------------
feign.client.config.default.connectTimeout=5000
feign.client.config.default.readTimeout=10000
spring.cloud.nacos.discovery.ip=192.168.14.53
redis redis依赖
#redis
# Redis服务器地址
spring.redis.host=192.168.14.45
# Redis数据库索引(默认为0)
spring.redis.database=0
# Redis服务器连接端口
spring.redis.port=6379
# Redis服务器连接密码(默认为空)
#spring.redis.password=
# 连接池最大连接数(使用负值表示没有限制) 默认 8
spring.redis.lettuce.pool.max-active=8
# 连接池最大阻塞等待时间(使用负值表示没有限制) 默认 -1
spring.redis.lettuce.pool.max-wait=-1
# 连接池中的最大空闲连接 默认 8
spring.redis.lettuce.pool.max-idle=8
# 连接池中的最小空闲连接 默认 0
spring.redis.lettuce.pool.min-idle=0
## 连接超时时间(毫秒)
spring.redis.timeout=30000
MQ
#---连接MQ
spring.rabbitmq.host=192.168.14.54
spring.rabbitmq.virtual-host=/
spring.rabbitmq.port=5672
#-------------RabbitMQ配置----------
#最大抓取数量
spring.rabbitmq.listener.simple.prefetch=50
#是否开启自动应答,默认为true
spring.rabbitmq.listener.simple.acknowledge-mode=auto
#开启自动应答机制
spring.rabbitmq.listener.simple.retry.enabled=false
#设置重试次数,默认三次
spring.rabbitmq.listener.simple.retry.max-attempts=3
#设置重试间隔时间 单位ms
spring.rabbitmq.listener.simple.retry.initial-interval=1000ms
#设置时间间隔倍数,默认是1倍
spring.rabbitmq.listener.simple.retry.multiplier=2
#设置间隔时间
spring.rabbitmq.listener.simple.retry.max-interval=8000ms
OSS oss依赖
application.yml
aliyun:oss:end-point: oss-cn-hangzhou.aliyuncs.comaccess-key-id: LTAI5tP1PMBCTZwQQkaxFtJvaccess-key-secret: PQu9XnsM2967Ct2NCyaCUYgMNf3GeZbucket-name: wmsapp-images