swagger-codegen icon indicating copy to clipboard operation
swagger-codegen copied to clipboard

replace deprecated org.springframework.util.Base64Utils with Base64

Open ZeeD opened this issue 2 years ago • 11 comments

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

ZeeD avatar Mar 06 '23 08:03 ZeeD

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

fc-jfechner avatar Nov 25 '24 08:11 fc-jfechner

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?

The-Arne avatar Jan 28 '25 11:01 The-Arne

Hi @frantuma

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

knieszporek avatar Jan 29 '25 09:01 knieszporek

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.

The-Arne avatar Jan 31 '25 06:01 The-Arne

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

joernfechner avatar Mar 11 '25 22:03 joernfechner

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

chrlembeck avatar Apr 16 '25 14:04 chrlembeck

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

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

ykartsev avatar Jun 27 '25 23:06 ykartsev

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

dmitry-weirdo avatar Jul 16 '25 09:07 dmitry-weirdo

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);
  }
}

chrlembeck avatar Jul 16 '25 09:07 chrlembeck

Same issue for me

slyfer avatar Sep 02 '25 16:09 slyfer