Commit d2f63c762f0ce0327d9179b1dd2a784511c386b8

Authored by Igor Kulikov
1 parent cd0e8643

Fix circular dependency

... ... @@ -21,7 +21,9 @@ import freemarker.template.Template;
21 21 import lombok.extern.slf4j.Slf4j;
22 22 import org.apache.commons.lang3.StringUtils;
23 23 import org.jetbrains.annotations.NotNull;
  24 +import org.springframework.beans.factory.annotation.Autowired;
24 25 import org.springframework.context.MessageSource;
  26 +import org.springframework.context.annotation.Lazy;
25 27 import org.springframework.core.NestedRuntimeException;
26 28 import org.springframework.mail.javamail.JavaMailSenderImpl;
27 29 import org.springframework.mail.javamail.MimeMessageHelper;
... ... @@ -63,18 +65,20 @@ public class DefaultMailService implements MailService {
63 65 private final MessageSource messages;
64 66 private final Configuration freemarkerConfig;
65 67 private final AdminSettingsService adminSettingsService;
66   - private final TbApiUsageStateService apiUsageStateService;
67 68 private final TbApiUsageClient apiUsageClient;
68 69
  70 + @Lazy
  71 + @Autowired
  72 + private TbApiUsageStateService apiUsageStateService;
  73 +
69 74 private JavaMailSenderImpl mailSender;
70 75
71 76 private String mailFrom;
72 77
73   - public DefaultMailService(MessageSource messages, Configuration freemarkerConfig, AdminSettingsService adminSettingsService, TbApiUsageStateService apiUsageStateService, TbApiUsageClient apiUsageClient) {
  78 + public DefaultMailService(MessageSource messages, Configuration freemarkerConfig, AdminSettingsService adminSettingsService, TbApiUsageClient apiUsageClient) {
74 79 this.messages = messages;
75 80 this.freemarkerConfig = freemarkerConfig;
76 81 this.adminSettingsService = adminSettingsService;
77   - this.apiUsageStateService = apiUsageStateService;
78 82 this.apiUsageClient = apiUsageClient;
79 83 }
80 84
... ...