Class NtfyAutoConfiguration

java.lang.Object
io.github.pimak.ntfy.spring.NtfyAutoConfiguration
All Implemented Interfaces:
org.springframework.beans.factory.DisposableBean

@AutoConfiguration @EnableConfigurationProperties(NtfyProperties.class) public class NtfyAutoConfiguration extends Object implements org.springframework.beans.factory.DisposableBean
Auto-configuration that turns ntfy.* properties into a live ntfy integration for a Spring Boot application. It performs two independent jobs:
  • Installs (idempotently) an appender named "ntfy-auto" on the root logger so ERROR-level events are published as ntfy notifications. This runs once all singletons are ready, so the Spring-bound configuration always wins over any appender a zero-code auto-install may have attached earlier from env/sysprops.
  • Exposes an injectable NtfyClient bean for sending ad-hoc notifications from application code.

Backend-agnostic. This class names no logging-framework type. Each supported backend is a NtfyBackend contributed by a nested configuration guarded on its own classes, and the installer picks the first one that reports itself bound. That is what lets a spring-boot-starter-log4j2 application get alerting; before, a class-level @ConditionalOnClass on Logback skipped this entire auto-configuration on such a classpath, taking the NtfyClient bean and the Micrometer meters down with it.

  • Constructor Details

    • NtfyAutoConfiguration

      public NtfyAutoConfiguration()
  • Method Details

    • destroy

      public void destroy()
      Specified by:
      destroy in interface org.springframework.beans.factory.DisposableBean