1, configure the hot load environment, add the following code in Pom.xml
<Build> <!--Springloader Plugin - <Plugins> <plugin> <groupId>Org.springframework.boot</groupId> <Artifactid>Spring-boot-maven-plugin</Artifactid> <Dependencies> <Dependency> <groupId>Org.springframework</groupId> <Artifactid>springloaded</Artifactid> <version>1.2.7.RELEASE</version> </Dependency> </Dependencies> <executions> <Execution> <Goals> <goal>Repackage</goal> </Goals> <Configuration> <classifier>Exec</classifier> </Configuration> </Execution> </executions> </plugin> </Plugins> </Build>
2. Run as->maven Build
3, operation, error
java.lang.unsupportedclassversionerror:com/learn/spring_boot_hello/app:unsupported Major.minor version 52.0at Java.lang.ClassLoader.defineClass1 (Native Method) at Java.lang.ClassLoader.defineClass (classloader.java:800) at Java.security.SecureClassLoader.defineClass (secureclassloader.java:142) at Java.net.URLClassLoader.defineClass ( urlclassloader.java:449) at java.net.urlclassloader.access$100 (urlclassloader.java:71) at java.net.URLClassLoader$ 1.run (urlclassloader.java:361) at Java.net.urlclassloader$1.run (urlclassloader.java:355) at Java.security.AccessController.doPrivileged (Native Method) at Java.net.URLClassLoader.findClass ( urlclassloader.java:354) at Java.lang.ClassLoader.loadClass (classloader.java:425) at sun.misc.launcher$ Appclassloader.loadclass (launcher.java:308) at Java.lang.ClassLoader.loadClass (classloader.java:358) at Sun.launcher.LauncherHelper.checkAndLoadMain (launcherhelper.java:482) Exception in thread "main" [INFO]------------ ------------------------------------------------------------
4. Open the Run Configuration
Modify to JRE1.8
5. Modify the Code
6. Refresh the page
7, this time rerun the program prompt port is occupied, need to use another method
Add in app (need to implement create Lib directory and copy the jar package because the Maven Jar package physical path is not in the project)
-javaagent:.\lib\springloaded-1.2.7.release.jar-noverify
8. Successful operation
Summary: In fact, this method is not the simplest, the use of Jrebel is better than this, and more general.
Springboot Getting Started note (iii), hot load