I am using Feign with Spring and I want to call a rest client that does not respect any standard.
https://uglyservices.com/api/service1/{param1}?token={param2}&&data={jsonData}
I tried with the spring GetMapping but I could not. I've also tried using Feign annotations, for that, create this main class
@SpringBootApplication
@EnableAutoConfiguration
@EnableScheduling
@EnableFeignClients
public class MyApplication {
public static void main(String[] args) {
SpringApplication.run(MyApplication.class, args);
}
@Bean
public Contract useFeignAnnotations() {
return new Contract.Default();
}
}
and I have declared the service as follows
@FeignClient(name = "uglyservices-service",
url = "${propiedades.uglyservicesURL}")
public interface SimpleServices {
@RequestLine("GET /service1/{param1}?token={param2}&data={jsonData}")
public String crearCaso(@Param("param1") String param1, @Param(value = "param2", expander = PrefixExpander.class) String param2, @Param("jsonData") String jsonData);
static final class PrefixExpander implements Param.Expander {
@Override
public String expand(Object value) {
return value + "&";
}
}
}
But I can not get the url to be formed correctly.
I appreciate any advice. Sorry for my English.