Redefine a single java file from an external library in a java web application

Viewed 76

I need to redefine a single class file in a spring-boot application from an external library io.external.library until they update their code. I have this working by creating a single file with the same package name and class name in my own project.

src/main/java/io/external/library/TheirFile.java

I am a bit worried that this just happens to work and in different conditions the original file might be loaded into memory.

I have seen that there may be ways to achieve this in Gradle by unzipping and repackaging the jar file. This seems to be a bit of an overkill to me though considering this is a temp solution until the third party updates their code.

What is the simplest or best practice way to achieve this?

It is a spring-boot application and my build system is Gradle.

0 Answers
Related