Explorar o código

Fix loading order(?)

Riccardo Balbo %!s(int64=4) %!d(string=hai) anos
pai
achega
2de8a6a00d

+ 1 - 0
src/main/java/com/jayfella/website/config/EmailConfig.java

@@ -2,6 +2,7 @@ package com.jayfella.website.config;
 
 
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.DependsOn;
 import org.springframework.context.support.ResourceBundleMessageSource;
 import org.springframework.context.support.ResourceBundleMessageSource;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.JavaMailSenderImpl;
 import org.springframework.mail.javamail.JavaMailSenderImpl;

+ 1 - 4
src/main/java/com/jayfella/website/config/ThymeLeafConfig.java

@@ -1,7 +1,6 @@
 package com.jayfella.website.config;
 package com.jayfella.website.config;
 
 
 import nz.net.ultraq.thymeleaf.LayoutDialect;
 import nz.net.ultraq.thymeleaf.LayoutDialect;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Bean;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Configuration;
 import org.springframework.context.annotation.Description;
 import org.springframework.context.annotation.Description;
@@ -23,9 +22,7 @@ import com.jayfella.website.config.external.ServerConfig;
 @EnableWebMvc
 @EnableWebMvc
 public class ThymeLeafConfig implements WebMvcConfigurer {
 public class ThymeLeafConfig implements WebMvcConfigurer {
 
 
-    @Autowired
-    public SpringTemplateEngine templateEngine;
-
+   
     @Bean
     @Bean
     @Description("Thymeleaf template resolver serving HTML 5")
     @Description("Thymeleaf template resolver serving HTML 5")
     public ITemplateResolver templateResolver() {
     public ITemplateResolver templateResolver() {

+ 2 - 1
src/main/java/com/jayfella/website/service/EmailService.java

@@ -10,6 +10,7 @@ import com.jayfella.website.database.repository.UserRepository;
 import org.slf4j.Logger;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.context.annotation.DependsOn;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.JavaMailSender;
 import org.springframework.mail.javamail.MimeMessageHelper;
 import org.springframework.mail.javamail.MimeMessageHelper;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
@@ -24,7 +25,7 @@ import java.io.UnsupportedEncodingException;
 import java.util.List;
 import java.util.List;
 import java.util.Locale;
 import java.util.Locale;
 
 
-@Service
+@Service @DependsOn("templateEngine") 
 public class EmailService {
 public class EmailService {
 
 
     private static final Logger log = LoggerFactory.getLogger(EmailService.class);
     private static final Logger log = LoggerFactory.getLogger(EmailService.class);