New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for live reloading #228

Closed
picaron opened this Issue May 30, 2018 · 5 comments

Comments

Projects
None yet
5 participants
@picaron
Copy link

picaron commented May 30, 2018

A lot of modern frameworks now support live reloading when assets are modified.

It would be amazing to have something similar for Micronaut since this dramatically improves the developement workflow, one can make a code change and immediately test it without having to CTRL-C and start the app again.

I’ve seen the java framework Rapidoid implement a live reloading when some classes are changed.

@graemerocher

This comment has been minimized.

Copy link
Member

graemerocher commented May 30, 2018

There are various options for this:

  • JVM agent - use Spring Loaded or JRebel by configuring the agent (slows down application performance) but requires few changes to Micronaut itself
  • Classloader based reloading - Most frameworks take this approach. Increases complexity and can result in class leaks / cached class problems
  • Build Tool Reloading - Get the build tool to restart the server. This requires custom Gradle and Maven plugins which we would like to avoid

All of the above have their pros and cons. Maybe the least evil is ClassLoader based reloading. We will consider one of them.

However, since Micronaut runs so fast you can load your application in a unit test and run the test continuously within your IDE which is my personal favored approach.

graemerocher added a commit that referenced this issue Jul 10, 2018

@ZacharyKlein

This comment has been minimized.

Copy link
Contributor

ZacharyKlein commented Jul 16, 2018

Closing this for now; if anyone has other reloading solutions that we should consider please open a new issue for tracking those.

@bitsnaps

This comment has been minimized.

Copy link

bitsnaps commented Nov 11, 2018

@ZacharyKlein Does Ratpack use spring loaded or gradle continuous build mode to achieve this?
Hot reloading is very convenient way for rapid development, IMO unit tests aren't convenient to be used in every test.

@in28minutes

This comment has been minimized.

Copy link

in28minutes commented Dec 3, 2018

I agree with binsnaps. Hot reloading is very convenient way for rapid development. Unit tests are great but aren't the best option in every scenario.

@graemerocher graemerocher reopened this Dec 26, 2018

@graemerocher graemerocher added this to the 1.1.0 milestone Dec 26, 2018

graemerocher added a commit that referenced this issue Dec 26, 2018

@graemerocher

This comment has been minimized.

Copy link
Member

graemerocher commented Dec 26, 2018

For Micronaut 1.1 we have added support for automatic restarts which are preferable over using an agent or class loaders which have numerous disadvantages already discussed. The new feature is documented in

https://github.com/micronaut-projects/micronaut-core/blob/master/src/main/docs/guide/cli/reloading/automaticRestart.adoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment