These are chat archives for spring-cloud/spring-cloud

23rd
Feb 2016
Dreampie
@Dreampie
Feb 23 2016 02:32
This message was deleted
Hi,All.Yesterday I started the project have become the default return xml, Why?
blob
Spencer Gibb
@spencergibb
Feb 23 2016 02:34
those images don’t help. Care to explain more? What returns xml?
Dreampie
@Dreampie
Feb 23 2016 02:35
blob
must use .json to return json
Spencer Gibb
@spencergibb
Feb 23 2016 02:37
Send text, not an image. Is it related to spring cloud?
Dreampie
@Dreampie
Feb 23 2016 02:39
springDependencyManagementVersion = "0.5.4.RELEASE"
springBootGradlePluginVersion = "1.3.2.RELEASE"
springCloudStarterParentVersion = "Brixton.BUILD-SNAPSHOT"
only cloud is snapshot
Spencer Gibb
@spencergibb
Feb 23 2016 02:40
This is code you’ve written?
Dreampie
@Dreampie
Feb 23 2016 02:41
no,not modify any code
Spencer Gibb
@spencergibb
Feb 23 2016 02:41
is it your code?
Dreampie
@Dreampie
Feb 23 2016 02:42
yes
Spencer Gibb
@spencergibb
Feb 23 2016 02:43
do you have produces = "application/json" in your @RequestMapping?
Dreampie
@Dreampie
Feb 23 2016 02:44
GET request does not
blob
@RequestMapping(value = LogConstants.LOGS_PATH, method = RequestMethod.GET)
@RequestMapping(value = LogConstants.LOGS_PATH, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_VALUE)
Spencer Gibb
@spencergibb
Feb 23 2016 02:45
Again, I’m not going to look at screenshots of code. Add produces = "application/json”.
Dreampie
@Dreampie
Feb 23 2016 02:48
why,@RESTController default not json?
Spencer Gibb
@spencergibb
Feb 23 2016 02:49
I don’t know
Dreampie
@Dreampie
Feb 23 2016 02:50
any where can config default return value?
Spencer Gibb
@spencergibb
Feb 23 2016 02:50
I’m sure there is, but I don’t know.
Dreampie
@Dreampie
Feb 23 2016 02:52
yes, produces work fine,
Why do change this,@RESTController default return was json?
Spencer Gibb
@spencergibb
Feb 23 2016 02:53
we didn’t change it
Dreampie
@Dreampie
Feb 23 2016 02:53
jackson serializationInclusion: NON_NULL not work
creatorId: null,
createdAt: 1455876247000,
updaterId: null,
updatedAt: null,
json convert config all not work,
jackson:
    dateFormat: yyyy-MM-dd'T'HH:mm:ssZZ
    serializationInclusion: NON_NULL
Dreampie
@Dreampie
Feb 23 2016 03:31
springCloudStarterParentVersion = "Brixton.M5"
default return is json,but json config not work
  jackson:
    dateFormat: yyyy-MM-dd'T'HH:mm:ssZZ
    serializationInclusion: NON_NULL
    deserialization:
      failOnUnknownProperties: false
    parser:
      allowUnquotedFieldNames: true
    serialization:
      failOnEmptyBeans: false
      writeDatesAsTimestamps: false
{
id: 191,
url: "/types",
method: "POST",
data: "{"type":{"name":"测试","value":"V11111122"}}",
ip: "127.0.0.1",
creatorId: null,
createdAt: 1455876247000,
updaterId: null,
updatedAt: null,
type: {
id: 1,
name: "日志类型测试",
value: "/types",
creatorId: null,
createdAt: null,
updaterId: null,
updatedAt: 1453891360585,
deleterId: null,
deletedAt: null
}
}
Matt Benson
@mbenson
Feb 23 2016 17:39
@dsyer I agree that ThreadLocal was ugly. Is there some kind of available static reference to the Spring application or BeanFactory--ultimately ConversionService that the expander should be able to reach? Or, we could perhaps generate an Expander class per ConversionService instance.
Dave Syer
@dsyer
Feb 23 2016 17:40
Bleuch
So the problem is just that Feign only supports registering a class (not an instance)?
We appear to have a ThreadLocal with a default value, where you don't expect the value to change between threads.
So it's no better than a static global really?
Matt Benson
@mbenson
Feb 23 2016 17:43
not really, other than the unlikely possibility that there could be multiple application contexts on different threads.... and the problem is that they only register a class, not an instance, correct
Dave Syer
@dsyer
Feb 23 2016 17:44
It would be nice to fix it in Feign really. Not sure how feasible that is.
Matt Benson
@mbenson
Feb 23 2016 17:44
I set the default value on the TL just in case, but it shouldn't actually get used in practice.
Dave Syer
@dsyer
Feb 23 2016 17:44
Yeah, that's what made me puke on it
How do you know what threads are going to access your feign client at runtime?
Could be anything, right?
Or am I missing something?
Matt Benson
@mbenson
Feb 23 2016 17:46
I think the deal was that those should only get called early on as the proxy is getting built
Dave Syer
@dsyer
Feb 23 2016 17:46
Is it?
OK, I guess that's not quite so awful.
But using a ThreadLocal kind of implies that you expect it to be used in multiple threads
whereas you don't
You might as well just set a static global in your Expander to the default conversion service
Matt Benson
@mbenson
Feb 23 2016 17:49
I can do that. Would we just say that given the context of spring-cloud and thus spring-boot that any weirdness about that is beyond a supported structure? (multiple application contexts per JVM)
Dave Syer
@dsyer
Feb 23 2016 17:53
We definitely support that
So it's a tough call
Matt Benson
@mbenson
Feb 23 2016 18:03
I was going to ask if any of Feign's core devs hangs out in their gitter room?
Spencer Gibb
@spencergibb
Feb 23 2016 18:07
Yes they do
Matt Benson
@mbenson
Feb 23 2016 18:08
I guess it wouldn't hurt to bring it up and see what they think about making it possible to provide Expander instances.
Spencer Gibb
@spencergibb
Feb 23 2016 19:27
nope
David Welch
@dwelch2344
Feb 23 2016 22:57
Hey @spencergibb: we made the switch to Consul (vs Eureka) and are loving it so far. However, reverse proxying with Zuul seems to give us trouble. Our Zuul service is called "edge", and whenever we spin it up we get the following error: Unable to locate service in consul agent: edge-8080
Spencer Gibb
@spencergibb
Feb 23 2016 22:58
that’s odd, why edge-8080?
David Welch
@dwelch2344
Feb 23 2016 22:58
Spencer Gibb
@spencergibb
Feb 23 2016 22:59
ok
David Welch
@dwelch2344
Feb 23 2016 23:01
hrrrm I don't see anything specifying that setup, but even explicitly specifying the defaults as they are in the docs still fails with the same message
in theory, Zuul's reverse proxy should just drop in with the Consul discovery client, right?
Spencer Gibb
@spencergibb
Feb 23 2016 23:02
yup, I’m trying it right now.
David Welch
@dwelch2344
Feb 23 2016 23:07
So it looks like ConsulDiscoveryClient#getLocalServiceInstance() is blowing up on line 65 when the current service isn't found. If I set a breakpoint and override the service definition with an existing service (just to get past the null check) the app spins up and proxying works great
Spencer Gibb
@spencergibb
Feb 23 2016 23:07
hmm, my sample works, so there must be something else
what version are you using?
David Welch
@dwelch2344
Feb 23 2016 23:07
Doh... 1.0.0.M4
Spencer Gibb
@spencergibb
Feb 23 2016 23:09
yeah, I think I fixed that already. spring-cloud/spring-cloud-consul#112
David Welch
@dwelch2344
Feb 23 2016 23:09

So just bumped up to org.springframework.cloud:spring-cloud-starter-consul-all:1.0.0.M6 (apparently I suck at markdown)

do I need to upgrade the netflix projects too?

Spencer Gibb
@spencergibb
Feb 23 2016 23:18
Likely. Not using the gradle dependency plugin?
David Welch
@dwelch2344
Feb 23 2016 23:19
ah, got it. We were hoping to use some of the features (particularly the per-feign configuration options) from the 1.1.0-BUILD-SNAPSHOT line of the spring-cloud-netflix projects, but there must have been an incompatibility
any idea on when that 1.1.0 release will ship?
Spencer Gibb
@spencergibb
Feb 23 2016 23:21
We’re waiting on an RC from stream before we ship our RC, then after that it’s how many bugs there are.
David Welch
@dwelch2344
Feb 23 2016 23:24
pretend I'm just a humble application developer and don't understand such things ;) over / under: weeks? months? years?
Spencer Gibb
@spencergibb
Feb 23 2016 23:24
lol
David Welch
@dwelch2344
Feb 23 2016 23:24
a stretch, I know
Spencer Gibb
@spencergibb
Feb 23 2016 23:25
we committed to Q1 which ends march 31, which is weeks
if id did slip that it hopefully wouldn’t be too long
David Welch
@dwelch2344
Feb 23 2016 23:26
cool cool. awesome, thanks
and I won't hold you to that ;) just helpful to have the insight
Spencer Gibb
@spencergibb
Feb 23 2016 23:29
np