Skip to content

replace deprecated org.springframework.util.Base64Utils with Base64 #12080

Open
swagger-api/swagger-codegen-generators
#1117

Description

@ZeeD
Description

The resttemplate module relies on spring Base64Utils.
But latest version of the framework have deprecated it, suggesting to use Base64 from the stdlib.

Swagger-codegen version

I'm using the latest version from brew.

Swagger declaration file content or url
Command line used for generation
Steps to reproduce
Related issues/PRs
Suggest a fix/enhancement

Activity

  1. added a commit that references this issue on Mar 6, 2023
    a29522f
  2. fc-jfechner commented on Nov 25, 2024

    @fc-jfechner

    Swagger´s resttemplate module is not compatible with the newest spring boot version, because the depricated issue has been removed by spring.

  3. The-Arne commented on Jan 28, 2025

    @The-Arne

    The swagger code generator is currently incompatible with spring, at least for APIs that use basic auth. Is there a reason the merge request that fixes the problem sits ignored for almost a year now? Do you need another merge request? Are there any problems with the existing one? Or is the project just dead and nothing happens anymore, apart from some automated dependency updates?

  4. knieszporek commented on Jan 29, 2025

    @knieszporek

    Hi @frantuma

    Can you look at related pull requests (swagger-api/swagger-codegen-generators#1117).
    This issue blocks the upgrade to spring-boot 3.4.x

  5. The-Arne commented on Jan 31, 2025

    @The-Arne

    For anyone else running into this problem: We switched to https://github.com/OpenAPITools/openapi-generator/. This worked well, necessary code changes were minimal. And it's compatible with current spring-core.

  6. joernfechner commented on Mar 11, 2025

    @joernfechner

    Any updates or is the only way to fix this problem to switch on OpenAPI?

  7. chrlembeck commented on Apr 16, 2025

    @chrlembeck

    Trapped into same problem today. Can you please fix this incompatibility?

  8. garethmcnicol-lendingcrowd commented on May 30, 2025

    @garethmcnicol-lendingcrowd

    3.5.0 of spring boot has this issue too. Can we get the PR merged?

  9. ykartsev commented on Jun 27, 2025

    @ykartsev

    Voting for this issue as well. It prevents from updating to Spring Boot 3.4.x and above.

  10. dmitry-weirdo commented on Jul 16, 2025

    @dmitry-weirdo

    Any updates on this? I can't update to the newer Spring Boot since org.springframework.util.Base64Utils was removed from it.

  11. chrlembeck commented on Jul 16, 2025

    @chrlembeck

    As a workaround you can write your own Base64Utils class an put it into the package org.springframework.util in your own project.

    package org.springframework.util;
    
    import java.util.Base64;
    
    @Deprecated(forRemoval = true)
    public class Base64Utils {
    
      @Deprecated(forRemoval = true)
      public static String encodeToString(final byte[] bytes) {
        return Base64.getEncoder().encodeToString(bytes);
      }
    }
    
  12. slyfer commented on Sep 2, 2025

    @slyfer

    Same issue for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions