package com.example.controller;

import lombok.NonNull;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.MessageSource;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Locale;

@Slf4j
@RestController
@RequestMapping("/test")
public class TestController {

	@NonNull
	private MessageSource messageSource;


	@RequestMapping("/i18n")
	public String i18n(Locale locale) {
		Object[] args = {2, locale.getLanguage()};
		String message = messageSource.getMessage("it.works", args, locale);
		LOG.info(message);

		return message;
	}
}

@@ -49,16 +49,55 @@
 onNull;%0A
+import lombok.RequiredArgsConstructor;%0A
 import l
@@ -153,190 +153,506 @@
 ork.
-context.MessageSource;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0Aimport java.util.Locale;%0A%0A@Slf4j
+beans.factory.annotation.Autowired;%0Aimport org.springframework.context.MessageSource;%0Aimport org.springframework.mail.javamail.JavaMailSender;%0Aimport org.springframework.mail.javamail.MimeMessageHelper;%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0Aimport javax.mail.MessagingException;%0Aimport javax.mail.internet.MimeMessage;%0Aimport java.util.Locale;%0A%0A@Slf4j%0A@RequiredArgsConstructor(onConstructor = @__(@Autowired))
 %0A@Re
@@ -720,16 +720,63 @@
 ller %7B%0A%0A
+%09@NonNull%0A%09private JavaMailSender mailSender;%0A%0A
 %09@NonNul
@@ -1038,11 +1038,569 @@
 sage;%0A%09%7D
+%0A%0A%09@RequestMapping(%22/email%22)%0A%09public String testEmail() throws MessagingException %7B%0A%09%09LOG.info(%22test email sending%22);%0A%0A%09%09MimeMessage message = mailSender.createMimeMessage();%0A%09%09MimeMessageHelper helper = new MimeMessageHelper(message);%0A%09%09helper.setFrom(%22mychalvlcek@gmail.com%22);%0A%09%09helper.setTo(%22springtest@gustr.com%22);%0A%09%09helper.setSubject(%22Test Subject!%22);%0A%09%09helper.setText(%22Test of email message from Java.%22 +%0A%09%09%09%22Message could be found @ http://www.fakemailgenerator.com/#/gustr.com/springtest/%22);%0A%09%09mailSender.send(message);%0A%0A%09%09return %22Email was sent%22;%0A%09%7D
 %0A%7D%0A

add EP with dummy email sending