Patch 0001-Code-cleanup.patch applied.

This commit is contained in:
oreva 2016-11-06 10:23:19 +02:00
parent 309e1a2da7
commit 4d46d52733
4 changed files with 1 additions and 86 deletions

View File

@ -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();

View File

@ -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);

View File

@ -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;
}
}

View File

@ -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());
}
}