Class FileWatchRestartListener
java.lang.Object
io.micronaut.runtime.server.watch.event.FileWatchRestartListener
- All Implemented Interfaces:
ApplicationEventListener<FileChangedEvent>,EventListener
@Singleton
@Requires(beans=EmbeddedApplication.class) @Requires(property="micronaut.io.watch.restart",value="true",defaultValue="false")
public class FileWatchRestartListener
extends Object
implements ApplicationEventListener<FileChangedEvent>
Listener that stops the server if a file changes. Relies on external service like
gradle run --continuous or Kubernetes replication controller is required to restart the container.
The FileWatchConfiguration.RESTART property should be set to true to active.
- Since:
- 1.1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsConstructorDescriptionFileWatchRestartListener(EmbeddedApplication<?> embeddedApplication) Default constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidHandle an application event.booleansupports(FileChangedEvent event) Whether the given event is supported.
-
Constructor Details
-
FileWatchRestartListener
Default constructor.- Parameters:
embeddedApplication- The embedded application
-
-
Method Details
-
onApplicationEvent
Description copied from interface:ApplicationEventListenerHandle an application event.- Specified by:
onApplicationEventin interfaceApplicationEventListener<FileChangedEvent>- Parameters:
event- the event to respond to
-
supports
Description copied from interface:ApplicationEventListenerWhether the given event is supported.- Specified by:
supportsin interfaceApplicationEventListener<FileChangedEvent>- Parameters:
event- The event- Returns:
- True if it is
-