Hot swapping in Spring Boot

前端 未结 12 1589
别那么骄傲
别那么骄傲 2020-11-29 03:41

I\'ve been doing a P.O.C with Spring Boot.

So far it\'s been going really good and promising, but there\'s one major drawback: I\'m using an embedded server (i.e.,

12条回答
  •  孤独总比滥情好
    2020-11-29 04:09

    Assuming you are using gradle; use the following config in your build.gradle

    apply plugin: 'java'
    apply plugin: 'idea'
    apply plugin: 'spring-boot'
    apply plugin: 'application'
    
    applicationDefaultJvmArgs = ["-agentlib:jdwp=transport=dt_socket,address=localhost:7000,server=y,suspend=n"]
    
    mainClassName = "package.ApplicationRunner"
    

    Run the application from the IDE or command line using the command gradle build run

    Now the IDE can connect to the remote JVM (on port 7000) where the spring boot application runs. It also supports hot deployment of static files.

    or even you can run the main class from intelliJ if the dependencies are properly managed in the IDE. The main class is the class that contains the main method which will call SpringApplication.run("classpath:/applicationContext.xml", args);

提交回复
热议问题