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
SpringApplication.run
(which means all code executed on the second run) will not call methods that were added by anasm.MethodVisitor
to the bytecode. Even though the bytecode is exactly the same, these method calls never get through with the devtools installed. I still have no idea why, but removing the devtools fixes it. – Incontestable