Quarkus hot replace does not work for code in constructor
See original GitHub issueDescribe the bug Changes to code in the constructor of Java classes are not included in the hot reload, even though Quarkus reports that the class is reloaded.
Expected behavior Changing the code in the constructor of Java classes that are subject to hot reload should be included in the hot reload.
Actual behavior When code in constructor of a Java class is updated and a new request is made, the changes in the code are not reflected to reloaded class.
To Reproduce Follow the rest tutorial from Quarkus documentation to create a project. Basically this corresponds to running:
mvn io.quarkus:quarkus-maven-plugin:1.12.2.Final:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=rest-json-quickstart \
-DclassName="org.acme.rest.json.FruitResource" \
-Dpath="/fruits" \
-Dextensions="resteasy,resteasy-jackson"
Then start Quarkus with:
./mvnw compile quarkus:dev
Navigate to http://localhost:8080/resteasy-jackson/quarks using a modern browser This will display a JSON payload as a result of the GET http request.
Now update the code in JacksonResource
type’s constructor in the generated project code, while Quarkus is still running. Change any of the text values of items added to quarkus
field, for example, use the following:
quarks.add(new Quark("Up", "The updated value goes here."));
Save the changes to file.
Refresh the browser page. Quarkus will print to terminal that changes are detected to modified Java class and it is reloaded. The changes in the constructor code are not reflected to response from Quarkus. Browser still displays the same json payload.
Configuration As set by the mvn archetype above
Screenshots Not applicable
Environment (please complete the following information):
./mvnw --version
produces:
Apache Maven 3.6.3 (cecedd343002696d0abb50b32b541b8a6ba2883f)
Maven home: /home/<user-name>/.m2/wrapper/dists/apache-maven-3.6.3-bin/1iopthnavndlasol9gbrbg6bf2/apache-maven-3.6.3
Java version: 11.0.10, vendor: GraalVM Community, runtime: /usr/lib/jvm/graalvm-ce-java11-21.0.0.2
Default locale: en_US, platform encoding: UTF-8
OS name: "linux", version: "4.15.0-101-generic", arch: "amd64", family: "unix"
This code is run under Ubuntu 18.04.
Additional context N/A
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (11 by maintainers)
@grumpyrodriguez just add
quarkus.live-reload.instrumentation=false
to yourapplication.properties
and things will be back to the way it was.@stuartwdouglas @mkouba while I agree instrumentation has its perks, our previous live reload had a lot of success and one of the reasons was that it always worked and you didn’t have weird edge cases.
I am going to close this as we have reverted to not using instrumentation unless explicitly requested by the user.