11

I'm using spring boot devtools with my project. When i write

System.out.println("test");

before main, it printing twice in console.

public static void main(String[] args) {

    System.out.println("test");
    SpringApplication.run(TestApplication.class, args);
}

When i remove

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

in pom.xml file,it printing once

mrtasln
  • 574
  • 1
  • 5
  • 18

1 Answers1

6

Not only twice, if the spring context need to be refreshed, it will run once more.

I believe it is a designed behavior.

The devtools auto-refresh the context instead of restarting manually.

Charles Li
  • 61
  • 2