Liubsyy / HotSecondsIDEA

HotSeconds是一款Java远程热部署的插件,可实现秒级一键化热更新。插件分为HotSecondsClient(IDEA热部署插件)和HotSecondsServer(服务端javaagent热更新插件),可以热更新java和常用配置文件,也支持常用框架(Spring,MyBatis)的热更新,相对传统部署可节省大量时间提高开发效率。
GNU General Public License v2.0
376 stars 49 forks source link

springboot 2.7.12 controller 新增接口 热更新 无效 #58

Closed nanxing7 closed 9 months ago

nanxing7 commented 10 months ago

HOTSECONDS: 15:11:36.102 INFO Plugin 'org.hotswap.agent.plugin.tomcat.TomcatPlugin' initialized in ClassLoader 'TomcatEmbeddedWebappClassLoader context: ROOT delegate: true ----------> Parent Classloader: org.springframework.boot.loader.LaunchedURLClassLoader@74ad1f1f '. HOTSECONDS: 15:11:36.103 INFO Tomcat plugin initialized - Tomcat version '9.0.75.0'

Liubsyy commented 10 months ago

这个bug是Spring5以SpringBoot FatJar启动时spring失效的问题,这个在HotSecondsExtension的Spring5ResourceLoaderInjectClassLoaderPatch中修复了,可以打包HotSecondsExtension成jar包引用试试,过段时间我发布一下中央仓库

nanxing7 commented 10 months ago

Spring5ResourceLoaderInjectClassLoaderPatch

image

还是不行

hot-seconds-remote.xml

<?xml version="1.0" encoding="UTF-8"?>

<!-- 一键秒级远程热部署配置文件 -->
<!-- 此配置文件一共两套,为hot-seconds.xml和hot-seconds-remote.xml -->
<liubs>
    <!-- 这个是本地和远程连接的唯一id,务必保证hot-seconds.xml和hot-seconds-remote.xml相等 -->
    <secret>aaaaaaaabbbbbbbbbccccccccc</secret>

    <!-- 远程端口 -->
    <remote_port>2023</remote_port>

    <init_delay>3000</init_delay>

    <!-- 
        普通java项目填 AppClassLoader,
        Tomcat项目填 WebappClassLoader/ParallelWebappClassLoader(Tomcat8及以后的版本填ParallelWebappClassLoader), 
        SpringBoot项目填 LaunchedURLClassLoader 
    -->
    <classloader>LaunchedURLClassLoader</classloader>

    <!-- 这里的扩展classname是热加载某个文件的前置和后置操作,需要实现IHotExtHandler接口,复制IHotExtHandler.java到工程即可 -->
    <dev-ext>
        <classname>com.liubs.hotseconds.extension.AutoChoose</classname>
    </dev-ext>

</liubs>

启动命令

java -XXaltjvm=dcevm -javaagent:/root/HotSecondsServer/HotSecondsServer.jar=hotconf=/root/hot-deploy/hot-seconds-remote.xml -jar /root/hot-deploy/hot-deploy.jar
Liubsyy commented 9 months ago

HotSecondsServer-future4.1已修复,我试了下可以了,HotSecondsExtension无需引用

nanxing7 commented 9 months ago

HotSecondsServer-future4.1已修复,我试了下可以了,HotSecondsExtension无需引用

我测试也可以使用了