Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
architecture
/
glsx-archetype
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit c975a8b9
authored
Apr 21, 2023
by
刘宇峰
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
框架完善
1 parent
3108ef50
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
rest-archetype-framework/rest-admin-feign/src/main/java/com/glsx/plat/feign/config/FeignConfig.java
rest-archetype-framework/rest-admin-feign/src/main/java/com/glsx/plat/feign/config/FeignConfig.java
View file @
c975a8b
...
...
@@ -83,20 +83,20 @@ public class FeignConfig {
@ConditionalOnMissingBean
(
FeignProperties
.
class
)
@ConditionalOnProperty
(
name
=
"feign.enable"
,
havingValue
=
"true"
)
public
Encoder
feignEncoder
()
{
return
new
SpringEncoder
(
messageConverters
);
return
new
SpringEncoder
(
feignHttpMessageConverter
()
);
}
@Bean
@ConditionalOnMissingBean
(
FeignProperties
.
class
)
@ConditionalOnProperty
(
name
=
"feign.enable"
,
havingValue
=
"true"
)
public
Decoder
feignDecoder
()
{
return
new
OptionalDecoder
(
new
ResponseEntityDecoder
(
new
FeignResultDecoder
(
new
SpringDecoder
(
messageConverters
))));
return
new
OptionalDecoder
(
new
ResponseEntityDecoder
(
new
FeignResultDecoder
(
new
SpringDecoder
(
feignHttpMessageConverter
()
))));
}
private
ObjectFactory
<
HttpMessageConverters
>
feignHttpMessageConverter
()
{
final
HttpMessageConverters
httpMessageConverters
=
getSpringConverter
();
//
final HttpMessageConverters httpMessageConverters = getSpringConverter();
// final HttpMessageConverters httpMessageConverters = getGsonConverter();
//
final HttpMessageConverters httpMessageConverters = getFastJsonConverter();
final
HttpMessageConverters
httpMessageConverters
=
getFastJsonConverter
();
return
()
->
httpMessageConverters
;
}
...
...
@@ -116,10 +116,11 @@ public class FeignConfig {
}
private
HttpMessageConverters
getFastJsonConverter
()
{
//创建fastJson消息转换器
FastJsonHttpMessageConverter
converter
=
new
FastJsonHttpMessageConverter
();
List
<
MediaType
>
supportedMediaTypes
=
new
ArrayList
<>();
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_JSON
);
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_JSON_UTF8
);
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_ATOM_XML
);
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_FORM_URLENCODED
);
supportedMediaTypes
.
add
(
MediaType
.
APPLICATION_OCTET_STREAM
);
...
...
@@ -136,6 +137,7 @@ public class FeignConfig {
supportedMediaTypes
.
add
(
MediaType
.
TEXT_PLAIN
);
supportedMediaTypes
.
add
(
MediaType
.
TEXT_XML
);
converter
.
setSupportedMediaTypes
(
supportedMediaTypes
);
//创建配置类
FastJsonConfig
fastJsonConfig
=
new
FastJsonConfig
();
fastJsonConfig
.
setSerializerFeatures
(
SerializerFeature
.
WriteDateUseDateFormat
,
SerializerFeature
.
WriteNullStringAsEmpty
,
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment