diff --git a/src/main/resources/handlebars/Java/libraries/resttemplate/auth/HttpBasicAuth.mustache b/src/main/resources/handlebars/Java/libraries/resttemplate/auth/HttpBasicAuth.mustache index 5f535b3698..a438340836 100644 --- a/src/main/resources/handlebars/Java/libraries/resttemplate/auth/HttpBasicAuth.mustache +++ b/src/main/resources/handlebars/Java/libraries/resttemplate/auth/HttpBasicAuth.mustache @@ -2,9 +2,9 @@ package {{invokerPackage}}.auth; import java.io.UnsupportedEncodingException; import java.nio.charset.StandardCharsets; +import java.util.Base64; import org.springframework.http.HttpHeaders; -import org.springframework.util.Base64Utils; import org.springframework.util.MultiValueMap; {{>generatedAnnotation}} @@ -34,6 +34,6 @@ public class HttpBasicAuth implements Authentication { return; } String str = (username == null ? "" : username) + ":" + (password == null ? "" : password); - headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64Utils.encodeToString(str.getBytes(StandardCharsets.UTF_8))); + headerParams.add(HttpHeaders.AUTHORIZATION, "Basic " + Base64.getEncoder().encodeToString(str.getBytes(StandardCharsets.UTF_8))); } }