scoder
scoder

Reputation: 2611

FeignClient service name configure through application.properties not working

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")

Upvotes: 0

Views: 3785

Answers (1)

Polly Shaw
Polly Shaw

Reputation: 3222

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

userservice.name=userdetail-service

Upvotes: 3

Related Questions