alibaba / nacos

an easy-to-use dynamic service discovery, configuration and service management platform for building cloud native applications.
https://nacos.io
Apache License 2.0
30.07k stars 12.81k forks source link

Feign service name case sensitive #2188

Closed daviyang35 closed 4 years ago

daviyang35 commented 4 years ago

Issue Description

feature request

Describe what happened (or what feature you want)

ENV When i using FeignClient with nacos discovery. like this:

@FeignClient(name = "OPEN-SERVICE")
public interface OpenService {
    // ...
}

Service instance spring.application.name set is "open-service".

Behavior

  1. Using eureka as discovery center works fine.
  2. Using nacos as discovery center , report can not found the named "OPEN-SERVICE" instance.

Describe what you expected to happen

Hope to be consistent with Eureka's behavior and not sensitive to the case of the service name. Reduce the difficulty of migrating from Eureka.

How to reproduce it (as minimally and precisely as possible)

  1. Using nacos as discovery/config center.
  2. Feign service's spring.application.name set is lowercase.
  3. Feign client service @FeignClient field "name" set is uppercase.

Tell us your environment

I found this behavior on 2 env.

  1. SpringBoot 1.5.x , SpringCloud Edgware.SR6, spring-cloud-alibaba-dependencies 1.5.1.RELEASE
  2. SpringBoot 2.0.9, SpringCloud Finchley.SR4 , spring-cloud-alibaba-dependencies 2.0.1.RELEASE

Anything else we need to know?

daviyang35 commented 4 years ago

I found a solution. Gateway service add this config.

spring:
  cloud:
    gateway:
      discovery:
        locator:
          enabled: true
          lower-case-service-id: true