title: How do i resolve Consider defining a bean of type 'java.lang.String' in your configuration?
body: <p>I am getting the following error </p>
  
  <pre><code>Description:
  
  Parameter 0 of constructor in com.gambeat.site.utility.email.EmailStatus required a bean of type 'java.lang.String' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'java.lang.String' in your configuration.
  </code></pre>
  
  <p>This is the Email Status class</p>
  
  <pre><code>    package com.gambeat.site.utility.email;
  
  
  import org.springframework.stereotype.Component;
  
  @Component
  public class EmailStatus {
  
      public static final String SUCCESS = "SUCCESS";
  
      public static final String ERROR = "ERROR";
  
      private final String to;
      private final String subject;
      private final String body;
  
      private String status;
      private String errorMessage;
  
  
      public EmailStatus(String to, String subject, String body) {
          this.to = to;
          this.subject = subject;
          this.body = body;
      }
  
      public EmailStatus success() {
          this.status = SUCCESS;
          return this;
      }
  
      public EmailStatus error(String errorMessage) {
          this.status = ERROR;
          this.errorMessage = errorMessage;
          return this;
      }
  
      public boolean isSuccess() {
          return SUCCESS.equals(this.status);
      }
  
      public boolean isError() {
          return ERROR.equals(this.status);
      }
  
      public String getTo() {
          return to;
      }
  
      public String getSubject() {
          return subject;
      }
  
      public String getBody() {
          return body;
      }
  
      public String getStatus() {
          return status;
      }
  
      public String getErrorMessage() {
          return errorMessage;
      }
  
  }
  
  this is the EmailSender and HtmlEmailSender which calls the EmailStatus class respectively.
  
      package com.gambeat.site.utility.email;
  
  import org.slf4j.Logger;
  import org.slf4j.LoggerFactory;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.mail.javamail.JavaMailSender;
  import org.springframework.mail.javamail.MimeMessageHelper;
  import org.springframework.stereotype.Component;
  
  import javax.mail.internet.MimeMessage;
  
  @Component
  public class EmailSender {
  
      private static final Logger LOGGER = LoggerFactory.getLogger(EmailSender.class);
  
      @Autowired
      private JavaMailSender javaMailSender;
  
      public EmailStatus sendPlainText(String to, String subject, String text) {
  
          return sendM(to, subject, text, false);
  
      }
  
      public EmailStatus sendHtml(String to, String subject, String htmlBody) {
  
          return sendM(to, subject, htmlBody, true);
  
      }
  
      private EmailStatus sendM(String to, String subject, String text, Boolean isHtml) {
  
          try {
  
              MimeMessage mail = javaMailSender.createMimeMessage();
  
              MimeMessageHelper helper = new MimeMessageHelper(mail, true);
  
              helper.setTo(to);
  
              helper.setSubject(subject);
  
              helper.setText(text, isHtml);
  
              javaMailSender.send(mail);
  
              LOGGER.info("Send email '{}' to: {}", subject, to);
  
              return new EmailStatus(to, subject, text).success();
  
          } catch (Exception e) {
  
              LOGGER.error(String.format("Problem with sending email to: {}, error message: {}", to, e.getMessage()));
  
              return new EmailStatus(to, subject, text).error(e.getMessage());
          }
      }
  }
  </code></pre>
  
  <p>HtmlEmailSender class</p>
  
  <pre><code>    package com.gambeat.site.utility.email;
  
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.stereotype.Component;
  import org.thymeleaf.TemplateEngine;
  import org.thymeleaf.context.Context;
  
  @Component
  public class EmailHtmlSender {
  
      @Autowired
      private EmailSender emailSender;
  
      @Autowired
      private TemplateEngine templateEngine;
  
      public EmailStatus send(String to, String subject, String templateName, Context context) {
  
          String body = templateEngine.process(templateName, context);
  
          return emailSender.sendHtml(to, subject, body);
      }
  }
  </code></pre>
  
  <p>The problem started when I called the HtmlSendEmail in my service class</p>
  
  <pre><code>    package com.gambeat.site.services.implementation;
  
  import com.gambeat.site.entities.User;
  import com.gambeat.site.services.NotificationService;
  import com.gambeat.site.utility.email.EmailHtmlSender;
  import com.gambeat.site.utility.email.EmailStatus;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.mail.SimpleMailMessage;
  import org.springframework.mail.javamail.JavaMailSender;
  import org.springframework.stereotype.Service;
  import org.thymeleaf.context.Context;
  
  /**
   * Created by Oto-obong on 30/10/2017.
   */
  
  @Service
  public class DefaultNotificationService implements NotificationService {
  
      private JavaMailSender javaMailSender;
  
      private EmailHtmlSender emailHtmlSender;
  
      @Autowired
      public DefaultNotificationService(JavaMailSender javaMailSender, EmailHtmlSender emailHtmlSender){
  
          this.javaMailSender = javaMailSender;
  
          this.emailHtmlSender = emailHtmlSender;
  
      }
  
      @Override
      public EmailStatus SignUpConfirmation(User user, String url) {
  
          Context context = new Context();
  
          context.setVariable("salutation", String.format("Hello s%", user.getUserName()));
  
          context.setVariable("title", "Welcome to Gambeat");
  
          context.setVariable("message", "Lorem Lorem Lorem");
  
          context.setVariable("link", url);
  
          EmailStatus emailStatus = emailHtmlSender.send(user.getEmail(), "Welcome to Gambeat", "email/welcome", context);
  
          return emailStatus;
  
      }
  
      @Override
      public EmailStatus BroadCastViaEmail(String message) {
  
          return null;
  
      }
  
      @Override
      public EmailStatus BroadCastViaEmail(User user, String message) {
  
          return null;
  
      }
  
      @Override
      public EmailStatus SendTokenViaEmail(User user, String token) {
  
          Context context = new Context();
  
          context.setVariable("salutation", String.format("Hello s%", user.getUserName()));
  
          context.setVariable("title", "Welcome to Gambeat");
  
          context.setVariable("description", "Lorem Lorem Lorem");
  
          EmailStatus emailStatus = emailHtmlSender.send(user.getEmail(), "Welcome to Gambeat", "email/welcome", context);
  
          return emailStatus;
  
      }
  }
  </code></pre>
  
  <p>Based on peoples recommendation i was told to add the Email Status package class to my component scan, but it was to no avail, can someone please help me out? </p>