1.

How do you make sure your changes are loaded without restarting the Spring Boot Application when running in Embedded Server mode?

Answer»

You can achieve this by adding a starter dependency for DEV tools.

<dependency>     <groupId>org.springframework.boot</groupId>     <artifactId>spring-boot-devtools</artifactId>     <version>2.1.6.RELEASE</version> </dependency>

This is a very helpful feature in development, as it gives immediate feedback for code changes. This ENHANCES the productivity of developers to a great extent by saving time in restarts.

This is not a production-ready tool or feature and will be automatically disabled when RUNNING in production.

Applications using DevTools restart whenever a file on the classpath is modified.

Spring Boot DevTools PROVIDE the following additional features :

  1. You may need a way to configure global settings which are not tied to a particular application. Spring-boot-dev tools supports this by providing a global file is CALLED .spring-boot-dev tools.properties. You can store all such global settings in this file.
  2. Remote Debugging via HTTP :

To enable remote Debugging via HTTP, make sure you have following settings inside pom file 

<build>     <plugins>         <plugin>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-maven-plugin</artifactId>             <configuration>                 <excludeDevtools>false</excludeDevtools>             </configuration>         </plugin>     </plugins> </build>

Now when starting application , add following parameters to enable remote debugging :

-Xdebug -Xrunjdwp:server=y,transport=dt_socket,suspend=n

To change port for debugger , add following to application.properties file ( configuration file ) :

spring.devtools.remote.debug.local-port=8010

The default debugger port is 8000.



Discussion

No Comment Found