The new version of spring-boot-devtools is not easy to use, it is frequent to appear ClassCastException. I had to give it up.
Comment From: wilkinsona
Sorry to hear that you had problems with DevTools. Unfortunately, without some more information, we won't be able to help you. Have you read the section in the reference documentation on diagnosing class loading issues and followed its recommendations? If they do not help and you would like us to spend some more time trying to help you, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.
Comment From: zdu-strong
My repository: https://github.com/zdu-strong/temp-devtools Environmental requirements: Java v17 Steps to reproduce: 1. Run command:
./mvn clean compile spring-boot:run
- Open a browser, visit http://localhost:8080
- Comment out the code - userModel.toString();
- Visit http://localhost:8080 in browser. You will see the result.
Comment From: zdu-strong
Thank you. I think the problem is due to fastjson, I replaced it with gson and it solved the problem.
Comment From: myheavyhead
@zdu-strong Why not try it jackson :).
Comment From: zdu-strong
As you know jackson is more functional and I have switched to jackson😄. Thank you.