Dadata Suggestions API client for Spring (Java)
Dadata API client based on non-blocking HTTP client of Spring WebClient. Supports all methods of Suggestion API
Gradle:
Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.kuliginstepan:dadata-client:Tag'
}
Maven:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Step 2. Add the dependency
<dependency>
<groupId>com.github.kuliginstepan</groupId>
<artifactId>dadata-client</artifactId>
<version>Tag</version>
</dependency>
You need to add property dadata.client.token
with your Dadata API Token.
You may add property dadata.client.timeout
to configure dadata client request timeout.
Dadata client provides DadataClientAutoConfiguration
which configures DadataClient
bean for you.
Autowire DadataClient
in your beans and call api methods, for example:
@Service
public class SomeService {
@Autowired
private DadataClient client;
public Flux<Suggestion<Address>> getSuggestionsForAddress(String query) {
return client.suggestAddress(AddressRequestBuilder.create(query).build());
}
}
Request builders allow to filter and rank suggestions. More examples are available in the test
module