@@ -0,0 +1,1707 @@
+/*%0A * THE SOFTWARE IS PROVIDED %22AS IS%22, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR%0A * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS%0A * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR%0A * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER%0A * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN%0A * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.%0A */%0A%0Apackage com.mpalourdio.springboottemplate.controllers;%0A%0Aimport org.springframework.beans.factory.annotation.Value;%0Aimport org.springframework.boot.web.client.RestTemplateBuilder;%0Aimport org.springframework.web.bind.annotation.GetMapping;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0Aimport org.springframework.web.client.RestTemplate;%0A%0A@RequestMapping(%22/misc%22)%0A@RestController%0Apublic class MiscController %7B%0A%0A    private final String serverPort;%0A    private final String username;%0A    private final String password;%0A%0A%0A    public MiscController(%0A            @Value(%22$%7Bserver.port%7D%22) final String serverPort,%0A            @Value(%22$%7Badmin.username%7D%22) final String username,%0A            @Value(%22$%7Badmin.password%7D%22) final String password%0A    ) %7B%0A        this.serverPort = serverPort;%0A        this.username = username;%0A        this.password = password;%0A    %7D%0A%0A    @GetMapping(%22/basicauth%22)%0A    public String restTemplateWithBasicAuth() %7B%0A        final RestTemplate rt = new RestTemplateBuilder().basicAuthorization(username, password).build();%0A        return rt.getForObject(%22http://localhost:%22 + serverPort + %22/basicauth%22, String.class);%0A    %7D%0A%7D%0A

Add example for RestTemplateBuilder use