Patch 0001-Code-cleanup.patch applied.
This commit is contained in:
parent
309e1a2da7
commit
4d46d52733
|
@ -45,16 +45,6 @@ public class AppConfig extends WebMvcConfigurerAdapter {
|
|||
return resolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleMailMessage templateOrderMessage() {
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
message.setText("Dear %s %s, \nthank you for placing order.\n" +
|
||||
"\n" +
|
||||
"Sincerely yours,\n" +
|
||||
"Yourcompany.");
|
||||
return message;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleMailMessage templateSimpleMessage() {
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
|
|
|
@ -24,7 +24,6 @@ public class EmailServiceImpl implements EmailService {
|
|||
public void sendSimpleMessage(String to, String subject, String text) {
|
||||
try {
|
||||
SimpleMailMessage message = new SimpleMailMessage();
|
||||
|
||||
message.setTo(to);
|
||||
message.setSubject(subject);
|
||||
message.setText(text);
|
||||
|
|
|
@ -1,43 +0,0 @@
|
|||
package com.baeldung.spring.mail;
|
||||
|
||||
/**
|
||||
* Created by Olga on 8/22/2016.
|
||||
*/
|
||||
public class Order {
|
||||
|
||||
public Order(String customerEmail,
|
||||
String customerFirstName,
|
||||
String customerLastName) {
|
||||
this.customerEmail = customerEmail;
|
||||
this.customerFirstName = customerFirstName;
|
||||
this.customerLastName = customerLastName;
|
||||
}
|
||||
|
||||
private String customerEmail;
|
||||
private String customerFirstName;
|
||||
private String customerLastName;
|
||||
|
||||
public String getCustomerEmail() {
|
||||
return customerEmail;
|
||||
}
|
||||
|
||||
public void setCustomerEmail(String customerEmail) {
|
||||
this.customerEmail = customerEmail;
|
||||
}
|
||||
|
||||
public String getCustomerFirstName() {
|
||||
return customerFirstName;
|
||||
}
|
||||
|
||||
public void setCustomerFirstName(String customerFirstName) {
|
||||
this.customerFirstName = customerFirstName;
|
||||
}
|
||||
|
||||
public String getCustomerLastName() {
|
||||
return customerLastName;
|
||||
}
|
||||
|
||||
public void setCustomerLastName(String customerLastName) {
|
||||
this.customerLastName = customerLastName;
|
||||
}
|
||||
}
|
|
@ -1,31 +0,0 @@
|
|||
package com.baeldung.spring.mail;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.mail.SimpleMailMessage;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* Created by Olga on 8/22/2016.
|
||||
*/
|
||||
@Component
|
||||
public class OrderManager {
|
||||
@Autowired
|
||||
public EmailService emailService;
|
||||
|
||||
@Value("${attachment.invoice}")
|
||||
private String invoiceAttachmentPath;
|
||||
|
||||
@Autowired()
|
||||
@Qualifier("templateOrderMessage")
|
||||
public SimpleMailMessage template;
|
||||
|
||||
public void placeOrder(Order order) {
|
||||
emailService.sendSimpleMessageUsingTemplate(order.getCustomerEmail(),
|
||||
"Order Confirmation",
|
||||
template,
|
||||
order.getCustomerFirstName(),
|
||||
order.getCustomerLastName());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue