642b0be34257dee319c565202283b54d80c465d7.svn-base 742 B

1234567891011121314151617181920212223242526272829
  1. package org.jeecg.modules.monitor.service.impl;
  2. import org.springframework.boot.actuate.health.Health;
  3. import org.springframework.boot.actuate.health.HealthIndicator;
  4. import org.springframework.stereotype.Component;
  5. /**
  6. * 功能说明:自定义邮件检测
  7. *
  8. * @author: 李波
  9. * @email: 503378406@qq.com
  10. * @date: 2019-06-29
  11. */
  12. @Component
  13. public class MailHealthIndicator implements HealthIndicator {
  14. @Override public Health health() {
  15. int errorCode = check();
  16. if (errorCode != 0) {
  17. return Health.down().withDetail("Error Code", errorCode) .build();
  18. }
  19. return Health.up().build();
  20. }
  21. int check(){
  22. //可以实现自定义的数据库检测逻辑
  23. return 0;
  24. }
  25. }