diff --git a/spring-mvc-email/src/main/java/com/baeldung/spring/Application.java b/spring-mvc-email/src/main/java/com/baeldung/spring/Application.java index 7d92c2964a..f146ee1d04 100644 --- a/spring-mvc-email/src/main/java/com/baeldung/spring/Application.java +++ b/spring-mvc-email/src/main/java/com/baeldung/spring/Application.java @@ -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); - } } diff --git a/spring-mvc-email/src/main/java/com/baeldung/spring/app/config/AppConfig.java b/spring-mvc-email/src/main/java/com/baeldung/spring/app/config/AppConfig.java index 4fb684c2b6..9f8339c2fe 100644 --- a/spring-mvc-email/src/main/java/com/baeldung/spring/app/config/AppConfig.java +++ b/spring-mvc-email/src/main/java/com/baeldung/spring/app/config/AppConfig.java @@ -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; diff --git a/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/HomeController.java b/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/HomeController.java index 50643684d1..656e237a9e 100644 --- a/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/HomeController.java +++ b/spring-mvc-email/src/main/java/com/baeldung/spring/controllers/HomeController.java @@ -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. diff --git a/spring-mvc-email/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java b/spring-mvc-email/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java index 8ecde598f9..dab5400d25 100644 --- a/spring-mvc-email/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java +++ b/spring-mvc-email/src/main/java/com/baeldung/spring/mail/EmailServiceImpl.java @@ -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;