2

I've started to learn spring framework. Earlier I've used play framework.

Generally, spring is more powerful for me, but one thing bothers me: recompile time.

After changing one single line of code I have to click so many times F5 button on the web page of the project to make spring recompile source.

Is there any way to make it recompile on every change of source I made?

Please give me some of your suggestions. I am using:

  • Spring 4
  • Spring Tool Suite
  • Pivotal tc Server Developer Edition v3.0

Thanks in advance...

Rahul Kargwal
  • 487
  • 1
  • 5
  • 20
masterdany88
  • 5,041
  • 11
  • 58
  • 132

1 Answers1

6

I know this question is a bit old but just stumbled across it. Spring Boot DevTools will be the best solution to your problem. To include devtools support, simply add the module dependency to your build

Maven

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

Gradle

dependencies {
    compile("org.springframework.boot:spring-boot-devtools")
}

By default, any entry on the classpath that points to a folder will be monitored for changes. Note that certain resources such as static assets and view templates do not need to restart the application.

Please refer this link for more details. We are using the same in our projects. You will just have to add the dependency, and you are good.

Rahul Kargwal
  • 487
  • 1
  • 5
  • 20
  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/low-quality-posts/18766942) – Matteo Baldi Feb 08 '18 at 23:36
  • @MatteoBaldi Thank you for your comment, I agree and it is a great tip. Will edit this answer, and keep this in mind for future answers. Cheers! – Rahul Kargwal Feb 09 '18 at 01:32