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.,
You can get hot swapping:
Check this post to see more details: http://blog.netgloo.com/2014/05/21/hot-swapping-in-spring-boot-with-eclipse-sts/
I do not know how far this kind of support goes, but in case you use Eclipse IDE (or anyone reading this): starting up your Spring-Boot application via m2e in debug-mode (press the "Debug"-dropdown button and pick your maven run configuration item).
It works for me like a charm.
My maven run configuration item is configured as follows:
I am not using any further libraries (not even spring-boot-devtools).
That's it.
In Intellij, I can get this behavior. When the program is running in debug mode, select Run > Reload Changed Classes
Note: After Intellij completes the action, it might say Loaded classes are up to date. Nothing to reload
. This is misleading, because it actually DID reload your classpath resources.
My environment/setup includes:
Intellij 13
Embedded Tomcat
Run/Debug configuration of type 'Application' (which just uses a main class)
Serving static html, css and js (no jsp)
I recommend Thymeleaf (template engine), jRebel for personal developer. Thymeleaf template files are just HTML resources. So, they`re changed immediately after you edit template files.
How to perform Hot Swap in Springboot Application
When using gradle include following in the dependency:
compile group: 'org.springframework.boot', name: 'spring-boot-devtools', version: '2.0.1.RELEASE'
& providedRuntime('org.springframework.boot:spring-boot-starter-tomcat')
In application.properties add the property spring.devtools.restart.additional-paths=.
Build Gradle and then run application as bootRun
The application is ready to perform hot swap on modification of classes
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);