背景
开发环境下新加代码、改代码时要重启后生效(耗时间);需求:不用重启且支持springboot 、spring、MyBatis。
实现
下地地址:https://github.com/JetBrains/JetBrainsRuntime/releases
1.根据系统类型下载压缩包
2.解压后配置环境变量
将第一章中的JAVA环境中的JAVA_HOME值换成jbr17解压缩后的路径,
3.下载hotswap https://github.com/HotswapProjects/HotswapAgent/releases/tag/1.4.2-SNAPSHOT。
在jbr17的lib目录下新建文件夹hotswap ,将下载的hotswap-agent-1.4.2-SNAPSHOT.jar
重命名为hotswap-agent.jar放到hotswap 文件夹下。
4.运行配置
-XX:+AllowEnhancedClassRedefinition
-XX:HotswapAgent=external
-javaagent:目录jbr17/lib\hotswap-agent.jar=autoHotswap=true
-XX:+AllowEnhancedClassRedefinition
–add-opens=java.desktop/java.awt.event=ALL-UNNAMED
–add-exports=java.base/sun.nio.ch=ALL-UNNAMED
–add-opens=java.desktop/sun.font=ALL-UNNAMED
–add-opens=java.desktop/java.awt=ALL-UNNAMED
–add-opens=java.desktop/sun.awt=ALL-UNNAMED
–add-opens=java.base/java.lang=ALL-UNNAMED
–add-opens=java.base/java.util=ALL-UNNAMED
–add-opens=java.base/jdk.internal.misc=ALL-UNNAMED
–add-opens=java.base/jdk.internal.loader=ALL-UNNAMED
–add-opens=java.desktop/javax.swing=ALL-UNNAMED
–add-opens=java.desktop/sun.swing=ALL-UNNAMED
–add-opens=java.desktop/sun.lwawt.macosx=ALL-UNNAMED
–add-opens=java.desktop/sun.lwawt=ALL-UNNAMED
–add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED
–add-opens=java.desktop/java.awt.peer=ALL-UNNAMED
–add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED
–add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED
–add-opens=java.desktop/sun.awt.image=ALL-UNNAMED
–add-opens=java.desktop/sun.java2d=ALL-UNNAMED
–add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED
–add-opens=jdk.jdi/com.sun.tools.javac.code=ALL-UNNAMED
–add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED
–add-opens=java.base/com.sun.tools.jdi=ALL-UNNAMED
–add-exports=java.desktop/sun.font=ALL-UNNAMED
–add-exports=java.desktop/com.apple.eawt=ALL-UNNAMED
–add-opens=java.base/sun.nio.ch=ALL-UNNAMED
–add-exports=java.base/sun.security.action=ALL-UNNAMED
–add-exports=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED