Unused imports removed; Application filed cleaned up from the logic of sending email on startup.

This commit is contained in:
oreva 2016-09-18 20:53:09 +03:00
parent b86dd316bb
commit 2f4ac59c54
4 changed files with 3 additions and 27 deletions

View File

@ -1,33 +1,12 @@
package com.baeldung.spring;
import com.baeldung.spring.mail.EmailService;
import com.baeldung.spring.mail.EmailServiceImpl;
import com.baeldung.spring.mail.Order;
import com.baeldung.spring.mail.OrderManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ImportResource;
import org.springframework.mail.SimpleMailMessage;
import javax.annotation.PostConstruct;
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Autowired
public EmailService emailService;
@Autowired
public OrderManager orderManager;
@PostConstruct
public void postConstruct() {
Order order = new Order("user_email_address", "First Name", "Last Name");
orderManager.placeOrder(order);
}
}

View File

@ -4,7 +4,9 @@ import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.web.servlet.config.annotation.*;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import org.springframework.web.servlet.view.JstlView;
import org.springframework.web.servlet.view.UrlBasedViewResolver;

View File

@ -3,8 +3,6 @@ package com.baeldung.spring.controllers;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;
/**
* Created with IntelliJ IDEA.

View File

@ -1,15 +1,12 @@
package com.baeldung.spring.mail;
import com.baeldung.spring.web.dto.MailObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.core.io.FileSystemResource;
import org.springframework.mail.MailException;
import org.springframework.mail.SimpleMailMessage;
import org.springframework.mail.javamail.JavaMailSender;
import org.springframework.mail.javamail.MimeMessageHelper;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import javax.mail.MessagingException;
import javax.mail.internet.MimeMessage;