Spring Boot devtools provides an option to specify a 'trigger file'. That means, this will be the only file which will kick off the application restart if we modify it. This is good when we don't want to restart frequently on each file modification.
To use this option, we need to add the following application property:
@SpringBootApplication
public class ExampleMain {
public static void main(String[] args) {
SpringApplication.run(ExampleMain.class, args);
}
}
Run the application:
mvn spring-boot:run
Access the pages at /path1 and /path2. Modifying any file other than MyController2.java will not trigger the restart as shown in this video:
Example Project
Dependencies and Technologies Used:
Spring Boot 1.5.2.RELEASE Corresponding Spring Version 4.3.7.RELEASE
spring-boot-starter-web : Starter for building web, including RESTful, applications using Spring
MVC. Uses Tomcat as the default embedded container.
spring-boot-devtools : Spring Boot Developer Tools.
spring-boot-starter-tomcat : Starter for using Tomcat as the embedded servlet container. Default
servlet container starter used by spring-boot-starter-web.