Code cleaning.
This commit is contained in:
@@ -2,21 +2,21 @@ package fr.ippon.example.intellijfeatures.controller;
|
||||
|
||||
import fr.ippon.example.intellijfeatures.model.User;
|
||||
import fr.ippon.example.intellijfeatures.services.mail.EmailService;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static org.springframework.http.HttpStatus.NO_CONTENT;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/mails")
|
||||
public class MailController {
|
||||
public class EmailController {
|
||||
private final EmailService emailService;
|
||||
|
||||
public MailController(EmailService emailService) {
|
||||
public EmailController(EmailService emailService) {
|
||||
this.emailService = emailService;
|
||||
}
|
||||
|
||||
@PostMapping("/send")
|
||||
@ResponseStatus(NO_CONTENT)
|
||||
public void sendMail(@RequestBody User user) {
|
||||
emailService.sendMail(user);
|
||||
}
|
||||
@@ -2,13 +2,13 @@ package fr.ippon.example.intellijfeatures.services.mail;
|
||||
|
||||
import org.springframework.mail.javamail.JavaMailSender;
|
||||
import org.springframework.mail.javamail.MimeMessageHelper;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
@Service
|
||||
public class EmailSender {
|
||||
@Component
|
||||
class EmailSender {
|
||||
private final JavaMailSender javaMailSender;
|
||||
|
||||
public EmailSender(JavaMailSender javaMailSender) {
|
||||
|
||||
Reference in New Issue
Block a user