Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
spring-cloud-netflix
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
openSource
spring-cloud-netflix
Commits
6e078a88
Commit
6e078a88
authored
Jan 14, 2015
by
Spencer Gibb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make messageConverters lazy in SpringDecoder and SpringEncoder
fixes gh-129
parent
8fb85f26
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
4 deletions
+16
-4
pom.xml
pom.xml
+5
-0
pom.xml
spring-cloud-netflix-core/pom.xml
+4
-0
SpringDecoder.java
...rg/springframework/cloud/netflix/feign/SpringDecoder.java
+4
-2
SpringEncoder.java
...rg/springframework/cloud/netflix/feign/SpringEncoder.java
+3
-2
No files found.
pom.xml
View file @
6e078a88
...
...
@@ -258,6 +258,11 @@
<artifactId>
bootstrap
</artifactId>
<version>
3.2.0
</version>
</dependency>
<dependency>
<groupId>
javax.inject
</groupId>
<artifactId>
javax.inject
</artifactId>
<version>
1
</version>
</dependency>
</dependencies>
</dependencyManagement>
...
...
spring-cloud-netflix-core/pom.xml
View file @
6e078a88
...
...
@@ -136,6 +136,10 @@
<scope>
test
</scope>
</dependency>
<dependency>
<groupId>
javax.inject
</groupId>
<artifactId>
javax.inject
</artifactId>
</dependency>
<dependency>
<groupId>
com.google.guava
</groupId>
<artifactId>
guava
</artifactId>
</dependency>
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/SpringDecoder.java
View file @
6e078a88
...
...
@@ -17,6 +17,8 @@ import feign.Response;
import
feign.codec.DecodeException
;
import
feign.codec.Decoder
;
import
javax.inject.Provider
;
import
static
org
.
springframework
.
cloud
.
netflix
.
feign
.
FeignUtils
.
getHttpHeaders
;
/**
...
...
@@ -25,7 +27,7 @@ import static org.springframework.cloud.netflix.feign.FeignUtils.getHttpHeaders;
public
class
SpringDecoder
implements
Decoder
{
@Autowired
HttpMessageConverters
messageConverters
;
Provider
<
HttpMessageConverters
>
messageConverters
;
public
SpringDecoder
()
{
}
...
...
@@ -35,7 +37,7 @@ public class SpringDecoder implements Decoder {
if
(
type
instanceof
Class
||
type
instanceof
ParameterizedType
)
{
@SuppressWarnings
({
"unchecked"
,
"rawtypes"
})
HttpMessageConverterExtractor
<?>
extractor
=
new
HttpMessageConverterExtractor
(
type
,
messageConverters
.
getConverters
());
type
,
messageConverters
.
get
().
get
Converters
());
return
extractor
.
extractData
(
new
FeignResponseAdapter
(
response
));
}
...
...
spring-cloud-netflix-core/src/main/java/org/springframework/cloud/netflix/feign/SpringEncoder.java
View file @
6e078a88
...
...
@@ -15,6 +15,7 @@ import org.springframework.http.HttpOutputMessage;
import
org.springframework.http.MediaType
;
import
org.springframework.http.converter.HttpMessageConverter
;
import
javax.inject.Provider
;
import
java.io.ByteArrayOutputStream
;
import
java.io.IOException
;
import
java.io.OutputStream
;
...
...
@@ -29,7 +30,7 @@ public class SpringEncoder implements Encoder {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
SpringEncoder
.
class
);
@Autowired
HttpMessageConverters
messageConverters
;
Provider
<
HttpMessageConverters
>
messageConverters
;
public
SpringEncoder
()
{
}
...
...
@@ -48,7 +49,7 @@ public class SpringEncoder implements Encoder {
requestContentType
=
MediaType
.
valueOf
(
type
);
}
for
(
HttpMessageConverter
<?>
messageConverter
:
messageConverters
.
getConverters
())
{
for
(
HttpMessageConverter
<?>
messageConverter
:
messageConverters
.
get
().
get
Converters
())
{
if
(
messageConverter
.
canWrite
(
requestType
,
requestContentType
))
{
if
(
logger
.
isDebugEnabled
())
{
if
(
requestContentType
!=
null
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
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 comment