1.将本地的服务application.properties配置上环境变量
server.context-path=/
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
server.port=8080
spring.application.name=dev
spring.jackson.time-zone=GMT+8
# datasource
spring.datasource.type=com.alibaba.druid.pool.DruidDataSource
spring.datasource.initialize=false
spring.datasource.driverClassName=com.mysql.jdbc.Driver
spring.datasource.druid.master.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.druid.master.url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DB_P2P}?serverTimezone=GMT%2B8&allowMultiQueries=true&characterEncoding=utf-8
spring.datasource.druid.master.username=${MYSQL_USERNAME}
spring.datasource.druid.master.password=${MYSQL_PASSWORD}
spring.datasource.druid.slave.driver-class-name=com.mysql.jdbc.Driver
spring.datasource.druid.slave.url=jdbc:mysql://${MYSQL_HOST}:${MYSQL_PORT}/${MYSQL_DB_P2P}?serverTimezone=GMT%2B8&allowMultiQueries=true&characterEncoding=utf-8
spring.datasource.druid.slave.username=${MYSQL_USERNAME}
spring.datasource.druid.slave.password=${MYSQL_PASSWORD}
spring.datasource.tomcat.max-active=150
spring.datasource.tomcat.max-wait=60000
spring.datasource.tomcat.min-idle=10
spring.datasource.tomcat.validation-query=SELECT1
spring.datasource.tomcat.test-on-borrow=false
spring.datasource.tomcat.test-while-idle=true
spring.datasource.tomcat.time-between-eviction-runs-millis=18800
spring.datasource.tomcat.validation-interval=60000
# 分页
pagehelper.helperDialect=mysql
pagehelper.reasonable=true
pagehelper.supportMethodsArguments=true
pagehelper.params=count=countSql
pagehelper.returnPageInfo=check
# mybatis
mybatis.mapper-locations=classpath*:com/abc/**/**/*.xml
mybatis.type-aliases-package=com.abc.core.mybatis.bean
#actuator
#management.port=36662
#management.context-path=/
#---- upload file ----
spring.http.multipart.max-file-size=1024MB
spring.http.multipart.max-request-size=10240MB
file.upload.tempprefix=/usr/local/images
file.upload.prefix=/usr/local
file.upload.zcbpath=/images
spring.session.store-type=redis
#spring.redis.sentinel.master=mymaster
#spring.redis.sentinel.nodes=${REDIS_SENTINEL_NODES}
spring.redis.host=${REDIS_HOST}
spring.redis.port=${REDIS_PORT}
spring.redis.password=${REDIS_PASSWORD}
spring.session.redis.namespace=zcb_test
# 连接池最大连接数(使用负值表示没有限制)
spring.redis.pool.max-active=1000
# 连接池最大阻塞等待时间(使用负值表示没有限制
spring.redis.pool.max-wait=20
# 连接池中的最大空闲连接
spring.redis.pool.max-idle=20
# 连接池中的最小空闲连接
spring.redis.pool.min-idle=10
# 连接超时时间(毫秒)
spring.redis.timeout=0
spring.thymeleaf.cache=false
spring.thymeleaf.prefix=classpath:/templates/
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=HTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
#REDIS START
#redis.maxRedirections=10
#redis.maxWaitMillis=1500
#redis.maxTotal=2048
#redis.minIdle=20
#redis.maxIdle=200
#redis.jedisClusterNodes=127.0.0.1:6379
#REDIS END
#elasticsearch
#spring.data.elasticsearch.host=127.0.0.1
#spring.data.elasticsearch.host=172.17.169.66
#spring.data.elasticsearch.port=9301
#spring.data.elasticsearch.host=127.0.0.1
#spring.data.elasticsearch.port=9301
#spring.data.elasticsearch.local=false
#spring.data.elasticsearch.repositories.enabled=true
#spring.data.elasticsearch.cluster-name=elasticsearch
spring.data.elasticsearch.cluster-nodes=${ES_HOST}
spring.data.elasticsearch.port=${ES_PORT}
#---- aliyun sms 短信发送 ----
sms.templateCode=SMS_12
sms.vendor.confirm.tip=SMS_197455
sms.vendor.acceptCancel.tip=SMS_19
sms.order.applyCancel.tip=SMS_19789
sms.vendor.refuseCancel.tip=SMS_197
sms.vendor.refuseOrder=SMS_19746
sms.orderTemplateCode=SMS_1343
sms.orderCancelTemplateCode=SMS_17
sms.accessKey=xxx
sms.accessSecret=389NREybb
cookie.domainName=bbb.com
#------ mongodb,name是登录名,pass是密码 ------
spring.data.mongodb.uri=mongodb://${MONGOD_USER}:${MONGOD_PASSWORD}@${MONGOD_HOST}:${MONGOD_PORT}/${MONGOD_DATABASE}
#spring.data.mongodb.uri=mongodb://10.19.11.194:27017/test
#spring.data.mongodb.uri=mongodb://name:pass@localhost:27017/test
# if spring data repository support is enabled
#spring.data.mongo.repositories.enabled=true
#---- 日志
spring.profiles=dev
#logging.config=classpath:logback-spring.xml
logging.path=logs
logging.file=log.log
logging.level.root=INFO
logging.level.com.abc.core.mapper=INFO
logging.level.com.abc=INFO
logging.level.org.springframework=INFO
logging.level.org.mybatis=INFO
#rabbitmq连接池
spring.rabbitmq.zcb.host=${RABBITMQ_HOST}
spring.rabbitmq.zcb.port=${RABBITMQ_PORT}
spring.rabbitmq.zcb.username=${RABBITMQ_USER}
spring.rabbitmq.zcb.password=${RABBITMQ_PASSWORD}
spring.rabbitmq.zcb.virtual-host=/${NAMESPACE_ENV}
spring.rabbitmq.listener.concurrency=10
spring.rabbitmq.listener.max-concurrency=300
spring.rabbitmq.listener.prefetch=100
#spring.mail.host=smtp
#spring.mail.port=465
#[email protected]
#spring.mail.password=abc1
#spring.mail.host=abc.com
#spring.mail.port=26
#[email protected]
#spring.mail.password=abcd
#
use.self.email=false
spring.mail.host=siyun.com
spring.mail.port=465
[email protected]
spring.mail.password=KFX
spring.mail.default-encoding=UTF-8
spring.mail.properties.mail.smtp.starttls.enable=true
spring.mail.properties.mail.smtp.starttls.required=true
spring.mail.properties.mail.smtp.auth=true
spring.mail.properties.mail.smtp.socketFactory.class=javax.net.ssl.SSLSocketFactory
spring.mail.properties.mail.smtp.timeout=3000
spring.mail.properties.mail.smtp.connectiontimeout=3000
spring.mail.properties.mail.smtp.socketFactory.port=465
spring.mail.properties.mail.smtp.port=465
spring.mail.properties.mail.transport.protocol=smtp
shiro.redis.hostName=10.38.177.61
shiro.redis.password=abc
site.buyer=https://buyer-${NAMESPACE_ENV}.bbb.com
site.vendor=https://supplier-${NAMESPACE_ENV}.bbb.com
site.login=https://buyer-${NAMESPACE_ENV}.bbb.com
site.bid=https://buyer-${NAMESPACE_ENV}.bbb.com
login.path=https://buyer-${NAMESPACE_ENV}.bbb.com/login
vd.login.path=https://supplier-${NAMESPACE_ENV}.bbb.com/login?loginsite=1
2.在src/test下加单元测试类
3.在IDEA Edit Configurations加Environment variables配置
3.1点Edit Configurations
3.2 点击Modify options 勾选
3.3 勾选上Environment variables
3.4 配置 Environment variables
3.5 整理好后粘贴在此处
3.6 环境变量举例,可直接粘贴
COOKIE_DOMAIN_URL=xxx.com
DOMAIN_HS_BI=http://127.0.0.1:8080DOMAIN_OPS=ops-xxx.com
DOMAIN_SUPPLIER=supplier-xxx.com
ES_CLUSTER_NAME=10.66.88.117ES_HOST=10.101.15.44ES_PASSWORD=none
ES_PORT=9300EUREKA_HOST=10.103.25.14EUREKA_PORT=8761MONGOD_DATABASE=xx
MONGOD_HOST=10.98.33.55MONGOD_PASSWORD=password123
MONGOD_PORT=27017MONGOD_USER=zcb
MYSQL_HOST=192.168.100.16MYSQL_PASSWORD=QFi9JccxxxMYSQL_PORT=34MYSQL_USERNAME=root
NAMESPACE_ENV=dev
RABBITMQ_HOST=10.100.0.4RABBITMQ_PASSWORD=guest
RABBITMQ_PORT=5672RABBITMQ_USER=guest
REDIS_DB=0REDIS_HOST=10.108.124.80REDIS_PASSWORD=JOrvDxxxxREDIS_PORT=6379REDIS_TIMEOUT=10000ZOOKEEPER_HOST=10.106.44.54ZOOKEEPER_PASSWORD=password
ZOOKEEPER_PORT=2181MYSQL_DB_CONTRACT=dev_contract
MYSQL_DB_OPS=dev_ops
MYSQL_DB_P2P=dev_p2p
MYSQL_DB_PROJECT=dev_project
MYSQL_DB_RFP=dev_rfp
MYSQL_DB_WMS=dev_wms
SKYWALKING_OPTS=enable
SKYWALKING_HOST=skywalking-oap:11800
4.执行,Debug
本文转载自: https://blog.csdn.net/han_you_3214/article/details/139451317
版权归原作者 大丽子 所有, 如有侵权,请联系我们删除。
版权归原作者 大丽子 所有, 如有侵权,请联系我们删除。