title: UTF-8 encoding of application.properties attributes in Spring-Boot
body: <p>In my <code>application.properties</code> I add some custom attributes.</p>
  
  <pre><code>custom.mail.property.subject-message=This is a ä ö ü ß problem
  </code></pre>
  
  <p>In this class I have the representation of the custom attributes.</p>
  
  <pre><code>@Component
  @ConfigurationProperties(prefix="custom.mail.property")
  public class MailProperties {
      private String subjectMessage;
      public String getSubjectMessage() {
          return subjectMessage;
      }
      public void setSubjectMessage(String subjectMessage) {
          this.subjectMessage = subjectMessage;
      }
  </code></pre>
  
  <p>And here I use my <code>MailProperties</code>:</p>
  
  <pre><code>@Service
  public class SimpleUnknownResponseMessage extends MailProperties implements UnknownResponseMessage{
  
      private JavaMailSender javaMailSender;
  
      @Autowired
      public SimpleUnknownResponseMessage(JavaMailSender javaMailSender) {
          this.javaMailSender = javaMailSender;
      }
  
      @Override
      public void placeUnknownResponse(BookResponse bookResponse) {
          MimeMessage message = javaMailSender.createMimeMessage();
          try {
              MimeMessageHelper helper = new MimeMessageHelper(message, "UTF-8");
              helper.setSubject(this.getSubjectMessage());            
              javaMailSender.send(message);
  
          } catch (MessagingException e) {
              e.printStackTrace();
          }
      }
  </code></pre>
  
  <p><strong>While debugging I can see that my <code>this.getSubjectMessage()</code> variable has this value inside: <code>This is a Ã¤ Ã¶ Ã¼ Ã problem</code>. So before sending my mail I already have an UTF-8 encoding problem.</strong> </p>
  
  <p>I already checked the encoding of the <code>application.properties</code> file and its UTF-8. </p>
  
  <p>My IDE(STS/Eclipse) and the project properties are also set on UTF-8. </p>
  
  <p><strong>How can I set the UTF-8 encoding for the text of my custom attributes in the <code>application.properties</code> file?</strong></p>