Closed
Description
I did it originally for familiarity. Developers are trying to share the interface between the client and server. I'd rather use Feigns default parameters than promote that practice.
@adriancole @dsyer @mstine @mheath any opinions?
Activity
[-]Deprecate Spring MVC annotations on Feign[/-][+]Deprecate Spring MVC annotations on Feign?[/+]codefromthecrypt commentedon Nov 21, 2015
spencergibb commentedon Nov 21, 2015
@joshlong or @kbastani any thoughts?
kbastani commentedon Nov 21, 2015
I don't really know that this is a case of promoting bad practices or that it is really just a requirement of someone's bad architecture decisions (referring to #646). What we have here is a good pattern for implementation but a side-effect of bad practice leading to tight coupling. I say we keep the annotations and be opinionated in the documentation that it isn't advised to try and use a Feign client by extending a shared interface that the server-side controller has implemented. It is far better for service teams to publish versioned feign clients as artifacts so that client-side teams don't have to write them. The upside to this is that you can write integration tests against your versioned client-side contract and break the build, preventing breaking changes to consumers of the service. Alternatively, you can throw an exception in a controller that implements an interface with a feign client annotation.
joshlong commentedon Nov 21, 2015
Additionally the Feign support is still akin to a Spring Data repository like experience for building REST clients. It's powerful and convenient.
spencergibb commentedon Nov 21, 2015
I'm not saying drop feign support. Just support for using the mvc annotations. So instead of
@RequestMapping
you use the feign annotations like:Maybe using springmvc annotations is opt-in, rather than the default?
kbastani commentedon Nov 21, 2015
Maybe use
@ResponseMapping
instead of@RequestMapping
joshlong commentedon Jan 2, 2016
looking forward, Spring 5's reactive story features - wherever possible (of course) - Spring MVC annotations like
@RequestMapping
. it'd make sense to keep this support and let those annotations become a lingua franca for all things declarative and HTTP in Spring-land. Plus, it's one less conceptual jump. I think people would sooner use the JAX-RS annotations than anything Feign-specific, and I can't see how that's any better an outcome (not to mention an easier cognitive leap)cforce commentedon Jan 31, 2016
If the server side client artifact offers versioned Interface's (that shall be done always if not downwards compatible) with Mvc Anotations, why to forbid to make use of this contract on client side?
I think it's worth to point out in in which situations you could be drapped into the "yak hair-weave studio" and therfore it's no good practice. I can't see also why its better mixing JAX-RS anotations with Feign instead of MVC.
codefromthecrypt commentedon Feb 11, 2016
I think the general problem with trying to share HTTP server interfaces w/ clients fall in at least three categories:
All of the above doesn't mean it is a fools errand, some things can work well enough (provided one actually answers what enough is). Regardless, the result of attempts to share interfaces not designed to be shared usually means maintenance++ (and not very fun maintenance to review or maintain later)
PedroAlvarado commentedon Mar 1, 2016
We find feign spring-mvc annotations support useful for end-to-end testing spring boot apps using @WebIntegrationTest. We simply generate an interface off the controller, make it a feign client, and start using it in our tests. We've used a similar approach with CXF's(JAX-RS) JAXRSClientFactory and its been working great as well.
I'd like to suggest we keep this support primarily to ease end-to-end testing above all other reasons.
gauravrmazra commentedon May 10, 2016
Hi,
This is related to OpenFeign/feign#391
On server side, we consumes and produces specific type of content
Now, I was using feign client. What It does in case of GET when there is no requestBody it neither adds Content-Type to headers nor it creates a blank RequestBody and adds mediaType by converting Content-Type header. Whereas if the request is POST/PUT it create empty RequestBody if it is passed null and also passed the mediaType.
Shouldn't it be added Content-Type to headers in any of the above case because server consumes only specific type of Content. If we don't send Content-Type then server throws Unsupported media type exception.
My application is Spring based.
16 remaining items