'Define a bean from external library
I have a poblem.
I am working with api binance and I add this library to use all functionalities.
<dependency>
<groupId>io.github.binance</groupId>
<artifactId>binance-connector-java</artifactId>
<version>1.3.0</version>
</dependency>
This is the code of external library
public class Market {
private final String baseUrl;
private final RequestHandler requestHandler;
private final boolean showLimitUsage;
public Market(String baseUrl, String apiKey, boolean showLimitUsage) {
this.baseUrl = baseUrl;
this.requestHandler = new RequestHandler(apiKey);
this.showLimitUsage = showLimitUsage;
}
When I try to inject this classe I always receive the following error on SpringBoot
Consider defining a bean of type 'com.binance.connector.client.impl.spot.Market' in your configuration.
I have an controller and I use like this.
@RestController
public class ExampleController {
@Autowired
private Market market;
@RequestMapping(value = "/ping", method = RequestMethod.GET, produces = "application/json")
public ResponseEntity<String> ping() {
return ResponseEntity.ok(market.ping());
}
}
I try to add the class with ComponentScan.
The code of external library is only for read.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
