Just fix the same function invoke like this:

URI uri = UriComponentsBuilder
        .fromUriString("https://example.com/hotels/{hotel}?q={q}")
        .build("Westin", "123");

URI uri = UriComponentsBuilder
        .fromUriString("https://example.com/hotels/{hotel}?q={q}")
        .build("Westin", "123")
        .toUri(); // need to create a URI from this instance

Comment From: pivotal-cla

@yrucrew Please sign the Contributor License Agreement!

Click here to manually synchronize the status of this Pull Request.

See the FAQ for frequently asked questions.

Comment From: pivotal-cla

@yrucrew Thank you for signing the Contributor License Agreement!

Comment From: sbrannen

Hi @yrucrew,

Thanks for submitting your first pull request to the Spring Framework!

Please note that the org.springframework.web.util.UriComponentsBuilder.build(Object...) method returns a URI.

Thus, the examples you have modified were already correct.

In light of that I am closing this PR.