19 Ağustos 2021 Perşembe

Micronaut Http Client

Giriş
Açıklaması şöyle
Micronaut provides two ways of creating HTTP clients:

- A declarative HTTP Client
- A programmatic HTTP Client
Örnek
Şöyle yaparız
@Validated
public interface PetOperations {
    @Post
    Single<Pet> save(@NotBlank String name, @Min(1L) int age);
}

@Client("/pets") 
public interface PetClient extends PetOperations { 

    @Override
    Single<Pet> save(String name, int age); 
}

PetClient client = applicationContext.getBean(PetOperations.class);
Single<Pet> pet = client.save("Hoppie", 1));

Hiç yorum yok:

Yorum Gönder