How do I define bean of an Interface

225 views Asked by At

I am using Feign client to connect to external endpoint I have declared the endpoint in application.properties

@FeignClient(url = "${api.url}") 

public interface wealth {

@GetMapping("/items")

public Client getItems(@RequestParam("name") String name);

}

while I try to access the interface's endpoint from other class like

@service
public class WealthClient{
 
 public Wealth wealth;

 WealthClient(Wealth wealth){
this.wealth=wealth;

public Client getItems(String name){
return wealth.getItems(name);
}

Main class is

@SpringBootApplication
@EnableFeignClients(clients = "{Wealth.class})
public class ExampleApplication {
 
    public static void main(String[] args) {
        SpringApplication.run(ExampleApplication.class, args);
    }
}

I am getting Error like

consider defining bean of type Wealth in your configuration .

Thanks in Advance

0

There are 0 answers