Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Spring boot devtools dependency

Spring boot devtools dependency maven

Spring Boot includes an additional set of tools that can make the application development experience a little more pleasant.

By configuring spring-boot-devtools starters in pom.xml or build.gradle will automatically restart the container whenever files on the classpath change.

This can be a useful feature when working in an IDE like eclipse, as it gives a very fast feedback loop for code changes.

When working with eclipse IDE make sure project -> build automatically option is checked.

If you are using the browser as a client, then you can add live reload plugin to reload the browser whenever the container restarts

Configure pom.xml

4.0.0com.candidjava.spring.boot
	helloworld
	0.0.1-SNAPSHOThelloworld-dev-toolhttp://maven.apache.orgorg.springframework.boot
		spring-boot-starter-parent
		2.0.4.RELEASEUTF-81.8org.springframework.boot
			spring-boot-starter-web
		org.springframework.boot
			spring-boot-devtools
			trueorg.springframework.boot
				spring-boot-maven-plugin
			

Launch Spring boot application (Example.java)

Launch this as a spring boot application and hit http://localhost:8080/ and make some changes in the code, you will notice that console will automatically restart the container with changes. Live reload plugin in the browser will automatically refresh the browser page.

package com.candidjava.spring.boot.helloworld;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class Example {

 @RequestMapping("/")
 String home() {
  return "Hello candid welcome";
 }

 public static void main(String[] args) throws Exception {
  SpringApplication.run(Example.class, args);
 }

}


This post first appeared on Core Java,Servlet,Jsp,Struts,Hibernate,Spring Fram, please read the originial post: here

Share the post

Spring boot devtools dependency

×

Subscribe to Core Java,servlet,jsp,struts,hibernate,spring Fram

Get updates delivered right to your inbox!

Thank you for your subscription

×