@Singleton @Requires(beans=EmbeddedApplication.class) @Requires(property="micronaut.io.watch.restart",value="true",defaultValue="false") public class FileWatchRestartListener extends Object implements ApplicationEventListener<FileChangedEvent>
gradle run --continuous
or Kubernetes replication controller is required to restart the container.
The FileWatchConfiguration.RESTART
property should be set to true to active.
Constructor and Description |
---|
FileWatchRestartListener(EmbeddedApplication<?> embeddedApplication)
Default constructor.
|
FileWatchRestartListener(EmbeddedServer embeddedServer)
Deprecated.
Use
FileWatchRestartListener(EmbeddedApplication) instead. |
Modifier and Type | Method and Description |
---|---|
void |
onApplicationEvent(FileChangedEvent event)
Handle an application event.
|
boolean |
supports(FileChangedEvent event)
Whether the given event is supported.
|
@Inject public FileWatchRestartListener(EmbeddedApplication<?> embeddedApplication)
embeddedApplication
- The embedded application@Deprecated public FileWatchRestartListener(EmbeddedServer embeddedServer)
FileWatchRestartListener(EmbeddedApplication)
instead.embeddedServer
- The embedded serverpublic void onApplicationEvent(FileChangedEvent event)
ApplicationEventListener
onApplicationEvent
in interface ApplicationEventListener<FileChangedEvent>
event
- the event to respond topublic boolean supports(FileChangedEvent event)
ApplicationEventListener
supports
in interface ApplicationEventListener<FileChangedEvent>
event
- The event