Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add @FeignTest annotation for Feign Layer

Aperta
#427 4 commenti 39 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java, spring
Ambito
api, backend, testing

Direzione di ricerca

Iniziate confrontando gli esempi esistenti di @WebMvcTest e @SpringBootTest con la configurazione del consumer @AutoConfigureStubRunner descritta nell’issue. Definite cosa deve configurare @FeignTest per i client Feign e quali bean di produzione deve escludere, quindi verificate che un test del consumer possa effettuare richieste tramite l’astrazione Feign senza avviare l’applicazione completa.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

enhancement waiting for votes

Hello!
I started to integrate Spring Cloud Contract into existing project.

No problems on producer side. Base test class annotated with @WebMvcTest, so only Web Layer getting configured and has same state as for production deployment. Services mocked, Web works, tests passed, stubs published

Issue comes on consumer side.
We are using Feign as client. So Preferable solution is to create test, inject FeignClient with same configuration, as for production deployment and perform http requests using using Feign abstraction.

Example from documentation:

@RunWith(SpringRunner.class)
@SpringBootTest(webEnvironment=WebEnvironment.NONE)
@AutoConfigureStubRunner(ids = {"com.example:http-server-dsl:+:stubs:6565"},
        stubsMode = StubRunnerProperties.StubsMode.LOCAL)
public class LoanApplicationServiceTests

This will work, but in services with complex configuration it is difficult to create such configuration (@SpringBootTest).
All properties must be set, production only beans must be mocked, etc. More over - there is no need for Feign tests to create all service, configuration and controller beans.

So existent of special annotation for Feign Client Layer Test (@FeignTest) will helps a lot and sounds reasonable.
But to create this annotation deep knowledge of all Feign related spring auto configurations required (web converters, ribbon, eureka, jackson, etc.)

It would be great, if you will able to implement this annotation.

Thanks in advance,
Yesman Maxim.

Lingua principale
Java
Stelle
1.3k
Fork
837
Merge medio
1g 1h
PR unite (30g)
25

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-cloud/spring-cloud-openfeign

Tutte le issue di spring-cloud/spring-cloud-openfeign

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.