Hi I am new to openfeign, I am trying to use a controller class that builds fein clients, and would like to use the exertenalised 'baseurl' from config file, but its not reading it from the config file, it reads it in other parts of the project, in a debug mode this appears to be hitting even before the configuration class gets ready, please help.
@Data
@Component
public class MyController {
private MyTokenClient tokenClient;
private MyClient MyClient;
//TBD read from db
private String MyUserId;
private String MyPassword;
// need to get this value from config
@Value("${My.base-url}")
private String baseUrl = "https://api.test.annabanana.com";
@Autowired
public MyController() {
this.tokenClient = Feign.builder().contract(new SpringMvcContract())
.encoder(new GsonEncoder())
.decoder(new GsonDecoder())
.logger(new Slf4jLogger(MyTokenClient.class))
.logLevel(feign.Logger.Level.FULL)
.requestInterceptor(new BasicAuthRequestInterceptor("USER", "PASSWORD"))
.target(MyTokenClient.class, baseUrl);
this.MyClient = Feign.builder().contract(new SpringMvcContract())
.requestInterceptor(new MyRequestInterceptor()).target(MyClient.class, baseUrl);
}
}