Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
dc765b87
提交
dc765b87
编写于
5月 10, 2020
作者:
ibizdev
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
ibizdev提交
上级
3b1e9e6b
变更
7
显示空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
26 行增加
和
34 行删除
+26
-34
config.xml
config.xml
+5
-0
application-dev.yml
ibzuaa-boot/src/main/resources/application-dev.yml
+1
-1
Dockerfile
...a-provider/ibzuaa-provider-api/src/main/docker/Dockerfile
+1
-1
ibzuaa-provider-api.yaml
...uaa-provider-api/src/main/docker/ibzuaa-provider-api.yaml
+3
-1
application-api-dev.yml
...a-provider-api/src/main/resources/application-api-dev.yml
+1
-1
application-api-prod.yml
...-provider-api/src/main/resources/application-api-prod.yml
+1
-1
RemoteService.java
.../src/main/java/cn/ibizlab/util/service/RemoteService.java
+14
-29
未找到文件。
config.xml
浏览文件 @
dc765b87
...
@@ -37,6 +37,11 @@
...
@@ -37,6 +37,11 @@
git clone -b master $para2 ibzuaa/
git clone -b master $para2 ibzuaa/
export NODE_OPTIONS=--max-old-space-size=4096
export NODE_OPTIONS=--max-old-space-size=4096
cd ibzuaa/
cd ibzuaa/
mvn clean package -Papi
cd ibzuaa-provider/ibzuaa-provider-api
mvn -Papi docker:build
mvn -Papi docker:push
docker -H $para1 stack deploy --compose-file=src/main/docker/ibzuaa-provider-api.yaml ibzlab-rt --with-registry-auth
</command>
</command>
</hudson.tasks.Shell>
</hudson.tasks.Shell>
</builders>
</builders>
...
...
ibzuaa-boot/src/main/resources/application-dev.yml
浏览文件 @
dc765b87
server
:
server
:
port
:
8080
port
:
40002
ibzuaa-provider/ibzuaa-provider-api/src/main/docker/Dockerfile
浏览文件 @
dc765b87
...
@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
...
@@ -9,6 +9,6 @@ CMD echo "The application will start in ${IBZ_SLEEP}s..." && \
sleep ${IBZ_SLEEP} && \
sleep ${IBZ_SLEEP} && \
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-provider-api.jar
java ${JAVA_OPTS} -Djava.security.egd=file:/dev/./urandom -jar /ibzuaa-provider-api.jar
EXPOSE
8081
EXPOSE
40002
ADD
ibzuaa-provider-api.jar /ibzuaa-provider-api.jar
ADD
ibzuaa-provider-api.jar /ibzuaa-provider-api.jar
ibzuaa-provider/ibzuaa-provider-api/src/main/docker/ibzuaa-provider-api.yaml
浏览文件 @
dc765b87
...
@@ -3,9 +3,11 @@ services:
...
@@ -3,9 +3,11 @@ services:
ibzuaa-provider-api
:
ibzuaa-provider-api
:
image
:
registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-provider-api:latest
image
:
registry.cn-shanghai.aliyuncs.com/ibizsys/ibzuaa-provider-api:latest
ports
:
ports
:
-
"
8081:8081
"
-
"
40002:40002
"
networks
:
networks
:
-
agent_network
-
agent_network
environment
:
SPRING_CLOUD_NACOS_DISCOVERY_IP
:
172.16.180.237
deploy
:
deploy
:
mode
:
replicated
mode
:
replicated
replicas
:
1
replicas
:
1
...
...
ibzuaa-provider/ibzuaa-provider-api/src/main/resources/application-api-dev.yml
浏览文件 @
dc765b87
server
:
server
:
port
:
8081
port
:
40002
\ No newline at end of file
\ No newline at end of file
ibzuaa-provider/ibzuaa-provider-api/src/main/resources/application-api-prod.yml
浏览文件 @
dc765b87
server
:
server
:
port
:
8081
port
:
40002
ibzuaa-util/src/main/java/cn/ibizlab/util/service/RemoteService.java
浏览文件 @
dc765b87
package
cn
.
ibizlab
.
util
.
service
;
package
cn
.
ibizlab
.
util
.
service
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.serializer.SerializerFeature
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.alibaba.fastjson.support.config.FastJsonConfig
;
import
com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter
;
import
com.alibaba.fastjson.support.springfox.SwaggerJsonSerializer
;
import
feign.*
;
import
feign.*
;
import
feign.codec.Decoder
;
import
feign.codec.Decoder
;
import
feign.codec.Encoder
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.beans.factory.ObjectFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConverters
;
import
org.springframework.boot.autoconfigure.http.HttpMessageConverters
;
import
org.springframework.cloud.openfeign.FeignContext
;
import
org.springframework.cloud.openfeign.FeignContext
;
import
org.springframework.cloud.openfeign.support.SpringDecoder
;
import
org.springframework.cloud.openfeign.support.SpringDecoder
;
import
org.springframework.cloud.openfeign.support.SpringEncoder
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
org.springframework.http.converter.json.MappingJackson2HttpMessageConverter
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
import
java.util.concurrent.ConcurrentHashMap
;
import
java.util.concurrent.ConcurrentHashMap
;
...
@@ -94,9 +91,10 @@ public class RemoteService {
...
@@ -94,9 +91,10 @@ public class RemoteService {
object
=
Feign
.
builder
()
object
=
Feign
.
builder
()
//decoder指定对象解码方式
//decoder指定对象解码方式
.
decoder
(
this
.
feignDecoder
())
.
decoder
(
this
.
feignDecoder
())
.
encoder
(
this
.
feignEncoder
())
.
client
(
feignClient
)
.
client
(
feignClient
)
//options方法指定连接超时时长及响应超时时长
//options方法指定连接超时时长及响应超时时长
.
options
(
new
Request
.
Options
(
5000
,
5000
))
.
options
(
new
Request
.
Options
(
5000
,
5000
0
))
//retryer方法指定重试策略
//retryer方法指定重试策略
//.retryer(new Retryer.Default(5000, 5000, 3))
//.retryer(new Retryer.Default(5000, 5000, 3))
.
contract
(
feignContext
.
getInstance
(
serviceId
,
Contract
.
class
))
.
contract
(
feignContext
.
getInstance
(
serviceId
,
Contract
.
class
))
...
@@ -112,31 +110,18 @@ public class RemoteService {
...
@@ -112,31 +110,18 @@ public class RemoteService {
return
new
SpringDecoder
(
feignHttpMessageConverter
());
return
new
SpringDecoder
(
feignHttpMessageConverter
());
}
}
/**
private
Encoder
feignEncoder
()
{
* 设置解码器为fastjson
return
new
SpringEncoder
(
feignHttpMessageConverter
());
*
* @return
*/
private
ObjectFactory
<
HttpMessageConverters
>
feignHttpMessageConverter
()
{
final
HttpMessageConverters
httpMessageConverters
=
new
HttpMessageConverters
(
this
.
getFastJsonConverter
());
return
()
->
httpMessageConverters
;
}
}
private
FastJsonHttpMessageConverter
getFastJsonConverter
()
{
FastJsonHttpMessageConverter
converter
=
new
FastJsonHttpMessageConverter
();
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<>();
MediaType
mediaTypeJson
=
MediaType
.
valueOf
(
MediaType
.
APPLICATION_JSON_UTF8_VALUE
);
supportedMediaTypes
.
add
(
mediaTypeJson
);
converter
.
setSupportedMediaTypes
(
supportedMediaTypes
);
FastJsonConfig
config
=
new
FastJsonConfig
();
config
.
getSerializeConfig
().
put
(
JSON
.
class
,
new
SwaggerJsonSerializer
());
config
.
setSerializerFeatures
(
SerializerFeature
.
DisableCircularReferenceDetect
);
converter
.
setFastJsonConfig
(
config
);
return
converter
;
private
ObjectFactory
<
HttpMessageConverters
>
feignHttpMessageConverter
()
{
HttpMessageConverter
jsonConverter
=
new
MappingJackson2HttpMessageConverter
(
new
ObjectMapper
());
final
HttpMessageConverters
httpMessageConverters
=
new
HttpMessageConverters
(
jsonConverter
);
return
()
->
httpMessageConverters
;
}
}
@Configuration
@Configuration
public
class
FeignTokenInterceptor
implements
RequestInterceptor
{
public
class
FeignTokenInterceptor
implements
RequestInterceptor
{
...
...
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录