2

Context

Let's say we have a Spring app (spring.jar) dependent on lib.jar. This jar would have a method String getData(). This method would return the letter "A".

We would run the spring app with the following command:

java -cp "spring.jar:lib.jar" Main

After the spring application starts successfully, we can test it and surely we see that Spring shows the letter 'A' from the lib.jar.

The Question

Is there anyway to override the lib.jar (that will return now the letter 'B') and have this reflected in the spring server without restarting it?

Cristian
  • 1,590
  • 5
  • 23
  • 38

1 Answers1

0

In the pom.xml file add the spring dev tools dependency. This allows you run the application after any changes without restarting the application

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<version>2.3.12.RELEASE</version>
</dependency>
S Badal
  • 71
  • 3
  • Hi @S Badal, Thank you for your answer, but that solution builds spring automatically when a change within has been made. The problem is that `lib.jar` from my question is not part of the spring framework, so changing `lib.jar` will not trigger a rebuild in spring. And I would like to see the chages without having to restart or rebuild spring. – Cristian Jul 13 '21 at 08:38