Commit 07802ff2 by wilmiam

1.0.0

parent edb57498
...@@ -14,12 +14,21 @@ spring: ...@@ -14,12 +14,21 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
feign:
client:
config:
default:
connect-timeout: 2000 #连接超时时间
read-timeout: 10000 #读超时时间
ribbon:
# ribbon服务列表刷新间隔(单位ms)
ServerListRefreshInterval: 2000
...@@ -14,12 +14,11 @@ spring: ...@@ -14,12 +14,11 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
...@@ -27,5 +26,9 @@ feign: ...@@ -27,5 +26,9 @@ feign:
client: client:
config: config:
default: default:
connectTimeout: 5000 #连接超时时间 connect-timeout: 2000 #连接超时时间
readTimeout: 10000 #读超时时间 read-timeout: 10000 #读超时时间
ribbon:
# ribbon服务列表刷新间隔(单位ms)
ServerListRefreshInterval: 2000
...@@ -22,12 +22,11 @@ spring: ...@@ -22,12 +22,11 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
......
...@@ -6,8 +6,8 @@ spring: ...@@ -6,8 +6,8 @@ spring:
security: security:
user: user:
name: admin name: admin
password: 123456 password: GXfy2021
eureka: eureka: # 相关文章:https://blog.csdn.net/weixin_49149614/article/details/121059046
instance: instance:
#设置使用IP注册就会优先使用IP,hostname则无效 #设置使用IP注册就会优先使用IP,hostname则无效
prefer-ip-address: true prefer-ip-address: true
...@@ -17,10 +17,10 @@ eureka: ...@@ -17,10 +17,10 @@ eureka:
enable-self-preservation: false enable-self-preservation: false
# 主动检测失效间隔,配置成3秒,默认60000 # 主动检测失效间隔,配置成3秒,默认60000
eviction-interval-timer-in-ms: 3000 eviction-interval-timer-in-ms: 3000
# 禁用use-read-only-response-cache只读缓存或者减少response-cache-update-interval-ms更新缓存的时间间隔都可以更快的同步实例信息 # 拉取服务的时候,不从ReadOnlyCacheMap里查,直接从ReadWriteCacheMap取。
# use-read-only-response-cache: false use-read-only-response-cache: false # 关闭从ReadOnlyCacheMap拉取数据。
# 减少readWrite 和 readOnly 同步时间间隔。 # 缩短ReadWriteCacheMap向ReadOnlyCacheMap同步的时间间隔,默认30秒
response-cache-update-interval-ms: 3000 response-cache-update-interval-ms: 3000 # 减少readWrite 和 readOnly 同步时间间隔。readWrite更新到readOnly
client: client:
# 表示是否将自己注册到Eureka Server,默认为true。 # 表示是否将自己注册到Eureka Server,默认为true。
register-with-eureka: false register-with-eureka: false
......
package com.zq.file.controller; package com.zq.file.controller;
import com.zq.common.utils.AssertUtils; import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.UploadUtils;
import com.zq.common.vo.ResultVo; import com.zq.common.vo.ResultVo;
import com.zq.common.vo.UploadVo; import com.zq.common.vo.UploadVo;
import com.zq.file.utils.UploadUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -11,6 +11,9 @@ import org.slf4j.LoggerFactory; ...@@ -11,6 +11,9 @@ import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
/**
* @author wilmiam
*/
@Api(tags = "上传相关") @Api(tags = "上传相关")
@RestController @RestController
@RequestMapping("/file") @RequestMapping("/file")
......
package com.zq.common.utils; package com.zq.file.utils;
import com.zq.common.exception.BusinessException; import com.zq.common.exception.BusinessException;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.UuidUtils;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.FileUtils; import org.apache.commons.io.FileUtils;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
......
...@@ -14,12 +14,14 @@ spring: ...@@ -14,12 +14,14 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
ribbon:
# ribbon服务列表刷新间隔(单位ms)
ServerListRefreshInterval: 2000
...@@ -5,19 +5,21 @@ spring: ...@@ -5,19 +5,21 @@ spring:
name: GATEWAY-SERVER name: GATEWAY-SERVER
cloud: cloud:
gateway: gateway:
default-filters: default-filters: # 剔除响应头中重复的值 RETAIN_FIRST:只保留第一个 RETAIN_LAST:保留最后一个 RETAIN_UNIQUE:去除重复
- DedupeResponseHeader=Access-Control-Allow-Origin, RETAIN_UNIQUE - DedupeResponseHeader=Access-Control-Allow-Origin, RETAIN_UNIQUE
discovery: discovery:
locator: locator:
enabled: true enabled: true
lower-case-service-id: true
globalcors: globalcors:
cors-configurations: cors-configurations:
'[/**]': '[/**]':
#这里有个allowCredentials: true这个东西是设置允许访问携带cookie的,这点一定要和前端对应!
allowCredentials: true allowCredentials: true
#可以填写多个域名用","隔开 例如:"http://www.xiaolc.cn,https://spring.io" "*"代表允许所有
allowedOriginPatterns: "*" allowedOriginPatterns: "*"
allowedMethods: "PUT, POST, GET, OPTIONS, DELETE"
allowedHeaders: "*" allowedHeaders: "*"
maxAge: 3600 allowedMethods: "GET, POST, DELETE, PUT, OPTIONS"
routes: routes:
- id: api - id: api
uri: lb://API-SERVER uri: lb://API-SERVER
......
...@@ -14,12 +14,11 @@ spring: ...@@ -14,12 +14,11 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
...@@ -14,12 +14,21 @@ spring: ...@@ -14,12 +14,21 @@ spring:
eureka: eureka:
instance: instance:
prefer-ip-address: true prefer-ip-address: true
lease-renewal-interval-in-seconds: 5 #向服务端发送心跳间隔 lease-renewal-interval-in-seconds: 2 #向服务端发送心跳间隔
lease-expiration-duration-in-seconds: 15 #告诉服务端多少秒没收到心跳将我踢出掉。 lease-expiration-duration-in-seconds: 6 #告诉服务端多少秒没收到心跳将我踢出掉
instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port} instance-id: ${spring.cloud.client.ip-address}:${spring.application.name}:${server.port}
client: client:
# 客户端拉取readOnly缓存的时间间隔,默认是30s registry-fetch-interval-seconds: 2 #从服务端注册表中获取注册信息的时间间隔
registry-fetch-interval-seconds: 3 # 拉取注册表信息间隔时间
serviceUrl: serviceUrl:
defaultZone: @register.url@ defaultZone: @register.url@
feign:
client:
config:
default:
connect-timeout: 2000 #连接超时时间
read-timeout: 10000 #读超时时间
ribbon:
# ribbon服务列表刷新间隔(单位ms)
ServerListRefreshInterval: 2000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment