0

I am trying configure service name for FeignClient from application.properties.

It works when I hardcode my service name like below.

@FeignClient("userdetail-service")

public interface UserServiceClient {
@RequestMapping(
            method= RequestMethod.GET,
            value = "/alluser/getmyuser)
    String getUserDetails();
    }

But same thing does not work when I try through application.properties

@FeignClient("${userservice.name}")

public interface UserServiceClient {
@RequestMapping(
            method= RequestMethod.GET,
            value = "/alluser/getmyuser)
    String getUserDetails();
    }

and in my application.properties i added below

userservice.name="userdetail-service"

I get below error when I start spring application

java.lang.IllegalStateException: Service id not legal hostname ("userdetail-service")
scoder
  • 2,451
  • 4
  • 30
  • 70

1 Answers1

3

You don't need quotes in your application.properties file. Try

userservice.name=userdetail-service
Polly Shaw
  • 2,932
  • 1
  • 15
  • 21