| Line 11... |
Line 11... |
| 11 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
11 |
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
| 12 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
12 |
import org.springframework.boot.builder.SpringApplicationBuilder;
|
| 13 |
import org.springframework.cache.annotation.EnableCaching;
|
13 |
import org.springframework.cache.annotation.EnableCaching;
|
| 14 |
import org.springframework.context.annotation.Bean;
|
14 |
import org.springframework.context.annotation.Bean;
|
| 15 |
import org.springframework.context.annotation.ComponentScan;
|
15 |
import org.springframework.context.annotation.ComponentScan;
|
| - |
|
16 |
import org.springframework.context.annotation.Primary;
|
| 16 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
17 |
import org.springframework.context.support.PropertySourcesPlaceholderConfigurer;
|
| 17 |
import org.springframework.core.io.ClassPathResource;
|
18 |
import org.springframework.core.io.ClassPathResource;
|
| 18 |
import org.springframework.mail.javamail.JavaMailSender;
|
19 |
import org.springframework.mail.javamail.JavaMailSender;
|
| 19 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
20 |
import org.springframework.mail.javamail.JavaMailSenderImpl;
|
| 20 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
21 |
import org.springframework.scheduling.annotation.EnableScheduling;
|
| Line 42... |
Line 43... |
| 42 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
43 |
propertySourcesPlaceholderConfigurer.setLocation(new ClassPathResource("/META-INF/env.properties"));
|
| 43 |
return propertySourcesPlaceholderConfigurer;
|
44 |
return propertySourcesPlaceholderConfigurer;
|
| 44 |
}
|
45 |
}
|
| 45 |
|
46 |
|
| 46 |
@Bean(name="mailSender")
|
47 |
@Bean(name="mailSender")
|
| - |
|
48 |
@Primary
|
| 47 |
public JavaMailSender getGmailSender(){
|
49 |
public JavaMailSender sendGridMailSender(){
|
| 48 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
50 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
| 49 |
|
51 |
|
| 50 |
//Using gmail
|
52 |
//Using gmail
|
| 51 |
mailSender.setHost("smtp.sendgrid.net");
|
53 |
mailSender.setHost("smtp.sendgrid.net");
|
| 52 |
mailSender.setPort(587);
|
54 |
mailSender.setPort(587);
|
| Line 61... |
Line 63... |
| 61 |
|
63 |
|
| 62 |
mailSender.setJavaMailProperties(javaMailProperties);
|
64 |
mailSender.setJavaMailProperties(javaMailProperties);
|
| 63 |
return mailSender;
|
65 |
return mailSender;
|
| 64 |
}
|
66 |
}
|
| 65 |
|
67 |
|
| - |
|
68 |
@Bean
|
| - |
|
69 |
public JavaMailSender googleMailSender(){
|
| - |
|
70 |
JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
|
| - |
|
71 |
//Using gmail
|
| - |
|
72 |
mailSender.setHost("smtp.gmail.com");
|
| - |
|
73 |
mailSender.setPort(587);
|
| - |
|
74 |
mailSender.setUsername("build@shop2020.in");
|
| - |
|
75 |
mailSender.setPassword("cafe@nes");
|
| - |
|
76 |
|
| - |
|
77 |
Properties javaMailProperties = new Properties();
|
| - |
|
78 |
javaMailProperties.put("mail.smtp.starttls.enable", "true");
|
| - |
|
79 |
javaMailProperties.put("mail.smtp.auth", "true");
|
| - |
|
80 |
javaMailProperties.put("mail.transport.protocol", "smtp");
|
| - |
|
81 |
javaMailProperties.put("mail.debug", "true");//Prints out everything on screen
|
| - |
|
82 |
mailSender.setJavaMailProperties(javaMailProperties);
|
| - |
|
83 |
return mailSender;
|
| - |
|
84 |
}
|
| - |
|
85 |
|
| 66 |
@Autowired
|
86 |
@Autowired
|
| 67 |
private RunOnceTasks runOnceTasks;
|
87 |
private RunOnceTasks runOnceTasks;
|
| 68 |
|
88 |
|
| 69 |
@Autowired
|
89 |
@Autowired
|
| 70 |
private ScheduledTasks scheduledTasks;
|
90 |
private ScheduledTasks scheduledTasks;
|