OpenFeign / OpenFeign/feign

[Help] Have any idea about global config path

Open
#1,461 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Question: Is there a global config for path
Reason: Could some day v1 would be changed to v2 v3 vn(use an external tomcat deploy under different dir)....

feign comsumer:
Correct:

@FeignClient(name = "product-server",  path = "v1")
@Component
public interface ProductService {
    @RequestMapping(value = "getProduct")
    String getProduct();
}

Can not reach, hope there have a global config can set:

@FeignClient(name = "product-server")
@Component
public interface ProductService {
    @RequestMapping(value = "getProduct")
    String getProduct();
}

May someone would suggest use a property variable(like below), but... It's an old project, I do not want to modify it.

@FeignClient(name = "product-server", path = "${product-server.context-path}")
@Component
public interface ProductService {
    @RequestMapping(value = "getProduct")
    String getProduct();
}

product-server setting applications.yml

spring:
  application:
    name: product-server
server:
  port: 9999
  context-path: /v1
...
eureka:
  client:
    serviceUrl:
      defaultZone: xxx
...

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No repository file or test is named. Start by tracing how the @FeignClient path is resolved and reviewing the product-server context-path in application.yml; done means establishing whether a global path setting can be supported without changing each interface.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
api, backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.