[Use springloaded for hot deployment in Spring]spring-boot

Source: Internet
Author: User
0x0 Preface

Java implementation of the thermal deployment of the solution Jrebel more, but Jrebel is charged, before also wrote a "Nginx+tomcat? Cluster to solve the balanced load and production environment hot deployment," the solution, this can be said to be a pseudo-thermal deployment scenario, just through load balancing, In the production environment to solve the problem of smooth deployment, and can not solve the development environment, modify, delete, add code in time to effect the effect of the recent contact Spring-boot have seen springloaded hot deployment solution, so try to take a note here. 0x1_1 Critical Environment system: MacOS Sierra jdk:1.8 Spring-boot 1.3.5RELEASE Ide:intellij idea (partial operation only idea) 0x1 project configuration 0x1_1 Single-Moudle maven project

Spring-boot the rest is not in this statement of exhaustion, it is important to note that the Spring-boot is the official recommended entry function Application.java to be placed in the root directory . Pom.xml Add the following configuration:

<build>
        <plugins>
            <plugin>
                <groupid>org.springframework.boot</groupid >
                <artifactId>spring-boot-maven-plugin</artifactId>
                <dependencies>
                    <!-- Spring Hot Deployment-
                    <dependency>
                        <groupId>org.springframework</groupId>
                        < artifactid>springloaded</artifactid>
                        <version>1.2.6.RELEASE</version>
                    </ dependency>
                </dependencies>
            </plugin>
        </plugins>
    </build>

Start: mvn spring-boot:run
The following configuration table is configured successfully:

[INFO] Attaching agents: [/users/superzemo/.m2/repository/org/springframework/springloaded/1.2.6.release/ Springloaded-1.2.6.release.jar]

If Application.java is not in the root directory, or if there are multiple portals, you can modify the Pom.xml to configure the specified entry file as follows:

<build> <plugins> <plugin> &LT;GROUPID&GT;ORG.SPRINGFRAMEWORK.BOOT&L T;/groupid> <artifactId>spring-boot-maven-plugin</artifactId> <dependenc ies> <!--Spring Heat deployment-<dependency> <gro
                        Upid>org.springframework</groupid> <artifactId>springloaded</artifactId> <version>1.2.6.RELEASE</version> </dependency> & Lt;/dependencies> <configuration> <mainclass>org.zemo.controller.app Lication</mainclass> </configuration> <executions> &
                        Lt;execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>

Modified Build–>compile ' Xxx.java ', shortcut key command+shift+f9 (WINDOWS:CTRL+SHIFT+F9) 0x1_1 Multi-moudle maven project

This section should also apply to a single Moudle project, only because my project is special (or perhaps not configured) and can only be debug using the following method. In principle single moudle also applicable to interested friends can also try. Add the Debug hot deployment Run–>edit configuration–>+–> remote–>apply Use the default parameters. Add JVM parameters (one of two ways)
MVN spring-boot:run-drun.jvmarguments= "-xdebug-xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005" Configuration in Pom.xml:

<configuration>
    <jvmArguments>
       -xdebug-xrunjdwp:transport=dt_socket,server=y,suspend=y, address=5005
    </jvmArguments>
</configuration>
Debug run remote, start the project.
Modified Build–>compile ' Xxx.java ', shortcut key command+shift+f9 (WINDOWS:CTRL+SHIFT+F9) 0x2 Recording Macros macro Settings

For ease of operation, you can do the following configuration: Edit, Macros, Start Macro recording Click File, Save all Cilck Build--Make Project STOP macro Recording Save your recorded macro with the name Save&make

, Edit-Macros

Because idea is saved automatically, the new macros can be replaced with the original save Shortcut Command+s (ctrl+s)
Preferences (setting) –>keymap Main menu–>file– >save all Remove the original shortcut key Main menu–>edit–>macros–>save&make add shortcut command+s 0x3 references https://qbgbook.gitbooks.io/spring-boot-reference-guide-zh/content/I.%20Spring%20Boot%20Documentation/3.% 20first%20steps.html http://docs.spring.io/spring-boot/docs/1.4.1.BUILD-SNAPSHOT/maven-plugin/examples/ run-debug.html https://my.oschina.net/u/563848/blog/522548 http://stackoverflow.com/questions/29831953/ Maven-build-failing-when-generating-war-package-for-spring-boot-application http://stackoverflow.com/questions/ 23217002/how-do-i-tell-spring-boot-which-main-class-to-use-for-the-executable-jar 0x4 about me @ Author:zemo @Email: zemochen#126.com Welcome reprint, let more people learn something

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.