修改feign访问路径变成配置文件中

This commit is contained in:
dxc
2021-02-22 17:25:16 +08:00
parent 19ed1dc717
commit a1158034c8
11 changed files with 121 additions and 140 deletions

View File

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.AUCTION_SERVICE) @FeignClient(value = "${mconfig.service-name-auction}")
public interface EbtpAuctionApi { public interface EbtpAuctionApi {
/** /**
* 出始化竞拍项目信息 * 出始化竞拍项目信息

View File

@ -12,7 +12,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.CALIBRATION_SERVICE) @FeignClient(value = "${mconfig.service-name-calibration}")
public interface EbtpCalibrationApi { public interface EbtpCalibrationApi {
/** /**

View File

@ -20,7 +20,7 @@ import java.util.List;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.BID_SERVICE, fallbackFactory = EbtpMallBidClientFallback.class) @FeignClient(value = "${mconfig.service-name-bid}", fallbackFactory = EbtpMallBidClientFallback.class)
public interface EbtpMallBidApi { public interface EbtpMallBidApi {
/** /**

View File

@ -18,7 +18,7 @@ import java.util.Map;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.PROCESS_SERVICE,fallbackFactory = EbtpMallProcessClientFallback.class) @FeignClient(value = "${mconfig.service-name-process}",fallbackFactory = EbtpMallProcessClientFallback.class)
public interface EbtpMallProcessApi { public interface EbtpMallProcessApi {
/** /**

View File

@ -15,7 +15,7 @@ import java.util.List;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.RESPS_SERVICE) @FeignClient(value = "${mconfig.service-name-resps}")
public interface EbtpRespsApi { public interface EbtpRespsApi {
/** /**

View File

@ -14,7 +14,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.RSMS_SERVICE) @FeignClient(value = "${mconfig.service-name-rsms}")
public interface EbtpRsmsApi { public interface EbtpRsmsApi {
/** /**

View File

@ -13,7 +13,7 @@ import org.springframework.web.bind.annotation.RequestParam;
* @author daixc * @author daixc
* @date 2020/11/25 * @date 2020/11/25
*/ */
@FeignClient(value = ServiceNameConstants.TENDER_SERVICE) @FeignClient(value = "${mconfig.service-name-tender}")
public interface EbtpTenderApi { public interface EbtpTenderApi {
/** /**

View File

@ -12,7 +12,6 @@ import org.springframework.web.bind.annotation.RequestParam;
* @date 2020/12/21 * @date 2020/12/21
*/ */
@FeignClient(value = "${mconfig.service-name-resu}",fallbackFactory = MallResuClientFallback.class) @FeignClient(value = "${mconfig.service-name-resu}",fallbackFactory = MallResuClientFallback.class)
//@FeignClient(name="mall-resu",url = "http://3g6422829c.wicp.vip:38002/api/mall-resu",fallbackFactory = MallResuClientFallback.class)
public interface MallResuApi { public interface MallResuApi {
/** /**

View File

@ -12,8 +12,8 @@ import org.springframework.web.bind.annotation.RequestBody;
* @author daixc * @author daixc
* @date 2020/12/21 * @date 2020/12/21
*/ */
//@FeignClient(value = "${mconfig.service-price-query}") @FeignClient(value = "${mconfig.service-price-query}")
@FeignClient(name="biz-service-price-query",url = "http://172.16.15.75.vaiwan.com/",fallbackFactory = PriceQueryApiClientFallback.class) //@FeignClient(name="biz-service-price-query",url = "http://172.16.15.75.vaiwan.com/",fallbackFactory = PriceQueryApiClientFallback.class)
public interface PriceQueryApi { public interface PriceQueryApi {
/** /**

View File

@ -171,7 +171,16 @@ mconfig:
host-name: http://10.242.31.158/ host-name: http://10.242.31.158/
service-name-purp: mall-purp #采购系统委托项目微服务 service-name-purp: mall-purp #采购系统委托项目微服务
service-name-wfap: mall-wfap #重新评审 流程微服务 service-name-wfap: mall-wfap #重新评审 流程微服务
service-name-resu: mall-resu #重新评审 项目中心服务 service-name-resu: mall-resu #重新评审 项目中心查询服务
service-price-query: biz-service-price-query #商城询价服务
#内部服务
service-name-auction: biz-service-ebtp-auction #竞拍服务API
service-name-calibration: biz-service-ebtp-calibration #标段定标接口
service-name-bid: biz-service-ebtp-bid #标段出始化流程
service-name-process: biz-service-ebtp-process #标段出始化流程
service-name-resps: biz-service-ebtp-resps #标段应答文件
service-name-rsms: biz-service-ebtp-rsms #评审微服务
service-name-tender: biz-service-ebtp-tender #标段投标微服务
wfSectionNo: '001' wfSectionNo: '001'
wfSectionName: 采购方案审批 wfSectionName: 采购方案审批

View File

@ -2,42 +2,38 @@ server:
port: 18012 port: 18012
servlet: servlet:
context-path: / context-path: /
# --------------seata ------------
seata: # 对应 apollo 配置中心的应用名
app:
id: biz-service-ebtp-project-dev
# Apollo 配置信息
apollo:
meta: http://10.242.31.158:6001/
bootstrap:
namespace: application
enabled: true
eagerLoad:
enabled: true enabled: true
application-id: ${spring.application.name}
tx-service-group: ${spring.application.name}-group
enable-auto-data-source-proxy: true
use-jdk-proxy: false
service:
vgroup-mapping:
default: default
enable-degrade: false
disable-global-transaction: false
registry:
type: eureka
eureka:
weight: 1
service-url: http://${eureka.instance.hostname}:8761/eureka/
spring: spring:
aop: aop:
auto: true #开启spring的aop配置 auto: true #开启spring的aop配置
proxy-target-class: true proxy-target-class: true
application: application:
name: biz-service-ebtp-project name: biz-service-ebtp-project-dev
shardingsphere: shardingsphere:
datasource: datasource:
# names: ds0,ds1 #主从库名称 开启主从时必须打开
names: ds0 names: ds0
ds0: ds0:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
username: mall3-ebtp-dev username: root
password: mall3-ebtp-dev password: root
jdbc-url: jdbc:mysql://125.32.114.204:13306/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true jdbc-url: jdbc:mysql://10.242.31.158:3033/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
url: jdbc:mysql://125.32.114.204:13306/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true url: jdbc:mysql://10.242.31.158:3033/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
filters: stat,wall,log4j filters: stat,wall,log4j
maxActive: 20 maxActive: 20
initialSize: 1 initialSize: 1
@ -52,71 +48,48 @@ spring:
poolPreparedStatements: true poolPreparedStatements: true
maxOpenPreparedStatements: 20 maxOpenPreparedStatements: 20
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000 connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
# ds1:
# type: com.alibaba.druid.pool.DruidDataSource
# driver-class-name: com.mysql.jdbc.Driver
# username: root
# password: root
# jdbc-url: jdbc:mysql://localhost:3306/seata_order_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
# url: jdbc:mysql://localhost:3306/seata_order_1?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone=UTC
# filters: stat,wall,log4j
# maxActive: 20
# initialSize: 1
# maxWait: 60000
# minIdle: 1
# timeBetweenEvictionRunsMillis: 60000
# minEvictableIdleTimeMillis: 300000
# validationQuery: select 'x'
# testWhileIdle: true
# testOnBorrow: false
# testOnReturn: false
# poolPreparedStatements: true
# maxOpenPreparedStatements: 20
# connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
# masterslave: #读写分离设置
# load-balance-algorithm-type: round_robin #轮询策略
# master-data-source-name: ds0 #主库名称
# slave-data-source-names: ds1 #从库名称
# name: shardingDataSource #数据源名称
props: props:
sql: sql:
show: true show: true
jackson: jackson:
date-format: yyyy-MM-dd HH:mm:ss date-format: yyyy-MM-dd HH:mm:ss
time-zone: GMT+8 time-zone: GMT+8
serialization: serialization:
write-dates-as-timestamps: false write-dates-as-timestamps: false
# 天宫Kafka增加了安全认证需要配置安全属性
kafka: kafka:
bootstrap-servers: 127.0.0.1:9092 bootstrap-servers: 10.125.164.192:32005,10.125.164.193:32005,10.125.164.194:32005
template:
default-topic: jl_test
# 生产者配置参数
producer: producer:
# 写入失败时重试次数。当leader节点失效一个repli节点会替代成为leader节点此时可能出现写入失败 client-id: core-service-ebtp-crypt
# 当retris为0时produce不会重复。retirs重发此时repli节点完全成为leader节点不会产生消息丢失。 properties:
retries: 0 security.protocol: SASL_PLAINTEXT
# 每次批量发送消息的数量,produce积累到一定数据一次发送 sasl.mechanism: SCRAM-SHA-256
batch-size: 2 sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
# produce积累数据一次发送缓存大小达到buffer.memory就发送数据
buffer-memory: 33554432 # 消费者配置参数
#procedure要求leader在考虑完成请求之前收到的确认数用于控制发送记录在服务端的持久化其值可以为如下
#acks = 0 如果设置为零,则生产者将不会等待来自服务器的任何确认,该记录将立即添加到套接字缓冲区并视为已发送。在这种情况下,无法保证服务器已收到记录,并且重试配置将不会生效(因为客户端通常不会知道任何故障),为每条记录返回的偏移量始终设置为-1。
#acks = 1 这意味着leader会将记录写入其本地日志但无需等待所有副本服务器的完全确认即可做出回应在这种情况下如果leader在确认记录后立即失败但在将数据复制到所有的副本服务器之前则记录将会丢失。
#acks = all 这意味着leader将等待完整的同步副本集以确认记录这保证了只要至少一个同步副本服务器仍然存活记录就不会丢失这是最强有力的保证这相当于acks = -1的设置。
#可以设置的值为all, -1, 0, 1
acks: 1
key-serializer: org.apache.kafka.common.serialization.StringSerializer
value-serializer: org.apache.kafka.common.serialization.StringSerializer
consumer: consumer:
group-id: user-group group-id: core-service-ebtp-crypt-consumer
auto-offset-reset: earliest auto-offset-reset: latest
enable-auto-commit: true properties:
auto-commit-interval: 100 security.protocol: SASL_PLAINTEXT
key-deserializer: org.apache.kafka.common.serialization.StringDeserializer sasl.mechanism: SCRAM-SHA-256
value-deserializer: org.apache.kafka.common.serialization.StringDeserializer sasl.jaas.config: org.apache.kafka.common.security.scram.ScramLoginModule required username="jltest" password="Unicom#123";
#=========redis基础配置=========
# 天宫 redis 需要使用哨兵进行访问
redis: redis:
sentinel:
master: eshop-redis
nodes: 10.125.164.124:32718, 10.125.164.118:32716, 10.125.164.121:32716
password: Unicom#135
lettuce: lettuce:
# jedis: # jedis:
pool: pool:
maxTotal: 50 maxTotal: 50
minIdle: 1 minIdle: 1
@ -144,23 +117,14 @@ spring:
password: redis@CC1234 password: redis@CC1234
timeout: 6000 timeout: 6000
#=========eureka配置========= # 天宫Eureka配置
eureka: eureka:
instance:
# eureka 注册路径地址
prefer-ip-address: true
hostname: 125.32.114.204
ip-address: ${eureka.instance.hostname}
instance-id: ${eureka.instance.hostname}:${server.port}
client: client:
serviceUrl: service-url:
defaultZone: http://${eureka.instance.hostname}:8761/eureka/ defaultZone: http://10.242.31.158:5001/eureka,http://10.242.31.158:5002/eureka,http://10.242.31.158:5003/eureka
instance:
#=========log配置========= prefer-ip-address: true
#logging: instance-ip: ${spring.cloud.client.ip-address}:${server.port}
# level:
# org.springframework.cloud.alibaba.seata.web : info
# io.seata : info
mybatis-plus: mybatis-plus:
configuration: configuration:
@ -177,19 +141,7 @@ mybatis-plus:
logic-not-delete-value: normal # 逻辑删除标记:正常数据 logic-not-delete-value: normal # 逻辑删除标记:正常数据
logic-delete-value: deleted # 逻辑删除标记:已删除的数据 logic-delete-value: deleted # 逻辑删除标记:已删除的数据
type-aliases-package: com.chinaunicom.mall.ebtp.project type-aliases-package: com.chinaunicom.mall.ebtp.project
# --------------feign ------------
feign:
hystrix:
enabled: true
httpclient:
enabled: true
okhttp:
enabled: true
client:
config:
default:
connect-timeout: 60000
read-timeout: 60000
hystrix: hystrix:
command: command:
default: default:
@ -203,9 +155,10 @@ hystrix:
circuitBreaker: circuitBreaker:
sleepWindowInMilliseconds: 20000 sleepWindowInMilliseconds: 20000
forceClosed: true forceClosed: true
ribbon: ribbon:
ReadTimeout: 60000 #请求处理的超时时间 ReadTimeout: 20000 #请求处理的超时时间
ConnectTimeout: 60000 #请求连接超时时间 ConnectTimeout: 20000 #请求连接超时时间
MaxAutoRetries: 0 #对当前实例的重试次数 MaxAutoRetries: 0 #对当前实例的重试次数
MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1 MaxAutoRetriesNextServer: 1 #切换实例的重试次数 1
@ -215,8 +168,28 @@ mconfig:
seata-open-enabled: false seata-open-enabled: false
work-id: 1 #终端ID work-id: 1 #终端ID
datacenter-id: 1 #数据中心ID datacenter-id: 1 #数据中心ID
host-name: http://${eureka.instance.hostname} host-name: http://10.242.31.158/
service-name-purp: mall-purp #采购系统委托项目微服务 service-name-purp: mall-purp #采购系统委托项目微服务
service-name-wfap: wfap #重新评审 流程微服务 service-name-wfap: mall-wfap #重新评审 流程微服务
service-name-resu: mall-resu #重新评审 项目中心查询服务
service-price-query : biz-service-price-query #商城询价服务
#内部服务
service-name-auction: biz-service-ebtp-auction-dev #竞拍服务API
service-name-calibration: biz-service-ebtp-calibration-dev #标段定标接口
service-name-bid: biz-service-ebtp-bid-dev #标段出始化流程
service-name-process: biz-service-ebtp-process-dev #标段出始化流程
service-name-resps : biz-service-ebtp-resps-dev #标段应答文件
service-name-rsms : biz-service-ebtp-rsms-dev #评审微服务
service-name-tender : biz-service-ebtp-tender-dev #标段投标微服务
wfSectionNo: '001' wfSectionNo: '001'
wfSectionName: 采购方案审批 wfSectionName: 采购方案审批
# 用户暴露给 prometheus 的健康数据
management:
endpoints:
web:
exposure:
include: "*"
cors:
allowed-origins: "*"
allowed-methods: "*"