cursor[bot] opened a new issue, #4344:
URL: https://github.com/apache/hertzbeat/issues/4344

   ## Problem
   
   Docs and sample `application.yml` / docker-compose configs describe 
`spring.mail` as optional (“not required if you don’t use email notify”). In 
practice, HertzBeat **fails to start** when `spring.mail` is omitted.
   
   On `apache/hertzbeat:1.8.0`, startup dies with:
   
   ```
   Parameter 0 of constructor in
   org.apache.hertzbeat.alert.notice.impl.EmailAlertNotifyHandlerImpl
   required a bean of type 'org.springframework.mail.javamail.JavaMailSender'
   that could not be found.
   ```
   
   `EmailAlertNotifyHandlerImpl` constructor-injects `JavaMailSender`. Spring 
Boot only auto-configures that bean when `spring.mail.host` (etc.) is set. No 
mail config → no bean → application context fails → process exits.
   
   In Docker with `restart: unless-stopped`, this becomes a **crash loop** even 
when the only real notify path is webhook/Discord and email is never used.
   
   ## Expected
   
   - No `spring.mail` → HertzBeat starts normally.
   - Email notify channels are unavailable (or clearly report “mail not 
configured”) until mail is set.
   - Behavior matches the documented “mail optional” story.
   
   ## Actual
   
   - Missing `spring.mail` → fatal startup failure.
   - Workaround: add a **dummy** `spring.mail` block so `JavaMailSender` 
exists, even though nothing sends email.
   
   ## Environment
   
   - Image: `apache/hertzbeat:1.8.0`
   - Notify: webhook/Discord only (no email)
   - Deploy: Docker Compose, custom `application.yml` mounted
   
   ## Fix
   
   PR: (will link after open)
   
   Smoke-tested on DietPi at SHA `03956af9a87e9a2c214e9808e28f253edaf6bd8a` 
with `spring.mail` fully omitted: healthy container, Restarts=0, clear 
email-not-configured error on test send, no JavaMailSender startup crash.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: 
[email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to