Class FileWatchRestartListener
- java.lang.Object
-
- io.micronaut.runtime.server.watch.event.FileWatchRestartListener
-
- All Implemented Interfaces:
io.micronaut.context.event.ApplicationEventListener<FileChangedEvent>
,java.util.EventListener
@Singleton @Requires(beans=EmbeddedApplication.class) @Requires(property="micronaut.io.watch.restart",value="true",defaultValue="false") public class FileWatchRestartListener extends java.lang.Object implements io.micronaut.context.event.ApplicationEventListener<FileChangedEvent>
Listener that stops the server if a file changes. Relies on external service likegradle 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
-
-
Constructor Summary
Constructors Constructor Description FileWatchRestartListener(EmbeddedApplication<?> embeddedApplication)
Default constructor.FileWatchRestartListener(EmbeddedServer embeddedServer)
Deprecated.UseFileWatchRestartListener(EmbeddedApplication)
instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
onApplicationEvent(FileChangedEvent event)
boolean
supports(FileChangedEvent event)
-
-
-
Constructor Detail
-
FileWatchRestartListener
@Inject public FileWatchRestartListener(EmbeddedApplication<?> embeddedApplication)
Default constructor.- Parameters:
embeddedApplication
- The embedded application
-
FileWatchRestartListener
@Deprecated public FileWatchRestartListener(EmbeddedServer embeddedServer)
Deprecated.UseFileWatchRestartListener(EmbeddedApplication)
instead.- Parameters:
embeddedServer
- The embedded server
-
-
Method Detail
-
onApplicationEvent
public void onApplicationEvent(FileChangedEvent event)
- Specified by:
onApplicationEvent
in interfaceio.micronaut.context.event.ApplicationEventListener<FileChangedEvent>
-
supports
public boolean supports(FileChangedEvent event)
- Specified by:
supports
in interfaceio.micronaut.context.event.ApplicationEventListener<FileChangedEvent>
-
-