嗨,我刚开始学习反应式编程
我在这里有这段代码,我的流程应该是我将调用 tokenRepository 来获取令牌,然后使用 token.getAccessToken() 作为 cardRepository.findAllCards() 上的参数
public class CardService {
private final CardRepository cardRepository;
private final TokenRepository tokenRepository;
public CardService(CardRepositorycardRepository,
TokenRepository tokenRepository) {
this.cardRepository = cardRepository;
this.tokenRepository = tokenRepository;
}
public Mono<CardCollection> findAllCards(MultiValueMap<String, String> queryParams) {
Mono<Token> token =tokenRepository.requestToken();
// then I would like to use the token.getAccessToken
return cardRepository.findAllCards(token.getAccessToken, queryParams); // Then this should return Mono<CardCollection>
}
}
想知道这是否可能?