Fork me on GitHub

Conditionals

Note: this page is only relevant for Spring Boot applications.

The autoconfiguration class ot the starter module is guarded with ConditionalOnSystemd.

This conditional checks if running under Linux, and searches for the presence of the environment property NOTIFY_SOCKET.

Should there be a need to provide custom jsystemd beans, such as custom SystemdNotifyStatusProvider implementations, it is preferable to use this conditional on the configuration class providing them, as it preferable to not waste time building beans that will never be needed or used.

If you autowire the current Systemd to use it directly, then make sure to use the provided @ConditionalOnSystemd, or a similar @ConditionalOnBean(Systemd.class).